refactor: project structure
This commit is contained in:
30
examples/main.go
Normal file
30
examples/main.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"net/smtp"
|
||||
|
||||
"gitea.urkob.com/urko/emailsender/pkg/email"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Here fill with real data
|
||||
emailService := email.NewMailService(email.MailServiceConfig{
|
||||
Auth: smtp.PlainAuth("", "your@email.com", "your-password", "smtp.youremail.com"),
|
||||
Host: "smtp.youremail.com",
|
||||
Port: "587",
|
||||
From: "your@email.com",
|
||||
})
|
||||
|
||||
emailService.SendEmail(email.EmailMessage{
|
||||
To: "other@email.com",
|
||||
Subject: "Test Email",
|
||||
Body: "<html><body><p>Here your body, you can attach as html<p/></body></html>",
|
||||
Attachments: []email.EmailAttachment{
|
||||
{
|
||||
File: bytes.NewBuffer([]byte("test")), // This is an io.Reader
|
||||
Title: "document.pdf",
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user