Skip to content

femaref/ezmail

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ezmail

A library to create mail messages and ease golang net/smtp package usage.

Usage

Here is how to use this package to send a basic mail message.

msg := ezmail.Message{}
msg.SetFrom("Marc Weistroff", "marc@example.org")
msg.AddTo("Recipient 1", "recipient1@example.org")
msg.AddTo("", "foobar@example.org")
msg.AddCC("", "cc@example.org")
msg.Subject = "Hey, message subject"
msg.Body = "plain text body"
smtp.SendMail(addr, auth, msg.From.String(), msg.Recipients(), msg.Bytes())

Edge Cases

When sending emails through GMail SMTP servers, if you run into an error like:

555 5.5.2 Syntax error. z6sm27198953bkn.8 - gsmtp

Try changing the smtp.SendMail call in order to provide only the email addresses (without full names)

smtp.SendMail(addr, auth, msg.From.Address, msg.RecipientsEmails(), msg.Bytes())

License

The ezmail code is free to use and distribute, under the MIT license.

Build Status

About

package ezmail implements mail message creation to use with net/smtp package

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%