Thanks to visit codestin.com
Credit goes to github.com

Skip to content

prateek-forks/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", "[email protected]")
msg.AddTo("Recipient 1", "[email protected]")
msg.AddTo("", "[email protected]")
msg.AddCC("", "[email protected]")
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

 
 
 

Contributors

Languages

  • Go 100.0%