Skip to content

vanng822/postfix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

postfix

Sending mail through postfix SMTP server

example

import (
	"github.com/vanng822/postfix"
)
fromAddr := postfix.NewAddress(from, fromEmail)
toAddr := postfix.NewAddress(to, toEmail)
attachment := &postfix.Attachment{
	Filename:    "test.txt",
	ContentType: "text/plain",
	Content:     []byte("test attachment content"),
}

attachment2 := postfix.NewAttachment("test2.txt", "text/plain", []byte("test attachment content 2"))

msg, err := postfix.MultipartMessage(from, to, subject, text, html, attachment, attachment2)
if err != nil {
	log.Fatal("Postfix mailing with error", err)
}
err := postfix.Send(msg)
if err != nil {
	log.Fatal("Postfix mailing with error", err)
}

About

Sending mail through postfix SMTP server

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages