31 lines
700 B
Go
31 lines
700 B
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"net/smtp"
|
|
|
|
"gitea.urkob.com/urko/emailsender/pkg/email"
|
|
)
|
|
|
|
func main() {
|
|
// Here fill with real data
|
|
emailService := email.NewInsecure(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",
|
|
},
|
|
},
|
|
})
|
|
}
|