All Projects → domodwyer → Mailyak

domodwyer / Mailyak

Licence: mit
An elegant MIME/SMTP email library with support for attachments

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Mailyak

Vmime
VMime Mail Library
Stars: ✭ 218 (-10.66%)
Mutual labels:  mime, email, smtp
Mailmergelib
MailMergeLib is a mail message client library which provides comfortable mail merge capabilities for text, inline images and attachments, as well as good throughput and fault tolerance for sending mail messages.
Stars: ✭ 97 (-60.25%)
Mutual labels:  mime, email, smtp
Mailkit
A cross-platform .NET library for IMAP, POP3, and SMTP.
Stars: ✭ 4,477 (+1734.84%)
Mutual labels:  mime, email, smtp
Mailu
Insular email distribution - mail server as Docker images
Stars: ✭ 3,151 (+1191.39%)
Mutual labels:  email, smtp
Free Email Forwarding
The best free email forwarding for custom domains. Visit our website to get started (SMTP server)
Stars: ✭ 2,024 (+729.51%)
Mutual labels:  email, smtp
Email Verifier
✅ A Go library for email verification without sending any emails.
Stars: ✭ 162 (-33.61%)
Mutual labels:  email, smtp
Simple Mail
An SMTP library written in C++ for Qt. Allows applications to send emails (MIME with text, html, attachments, inline files, etc.) via SMTP. Supports SSL and SMTP authentication.
Stars: ✭ 134 (-45.08%)
Mutual labels:  mime, smtp
Hectane
Lightweight SMTP client written in Go
Stars: ✭ 200 (-18.03%)
Mutual labels:  email, smtp
Mnm
The legitimate email replacement — n-identity, decentralized, store-and-forward, open protocol, open source. (Server)
Stars: ✭ 162 (-33.61%)
Mutual labels:  email, smtp
Mailer
A light-weight, modular, message representation and mail delivery framework for Python.
Stars: ✭ 225 (-7.79%)
Mutual labels:  email, smtp
Ptorx
📩🛡 Email privacy. Anonymously send and receive with alias forwarding.
Stars: ✭ 187 (-23.36%)
Mutual labels:  email, smtp
Hermes
Golang package that generates clean, responsive HTML e-mails for sending transactional mail
Stars: ✭ 2,379 (+875%)
Mutual labels:  email, smtp
Nanolist
mailing lists - the unix way
Stars: ✭ 153 (-37.3%)
Mutual labels:  email, smtp
Papercut Smtp
Papercut SMTP -- The Simple Desktop Email Server
Stars: ✭ 2,094 (+758.2%)
Mutual labels:  email, smtp
Swift Smtp
Swift SMTP client
Stars: ✭ 162 (-33.61%)
Mutual labels:  email, smtp
Magma
The magma server daemon, is an encrypted email system with support for SMTP, POP, IMAP, HTTP and MOLTEN,. Additional support for DMTP and DMAP is currently in active development.
Stars: ✭ 1,740 (+613.11%)
Mutual labels:  email, smtp
Yagmail
Send email in Python conveniently for gmail using yagmail
Stars: ✭ 2,169 (+788.93%)
Mutual labels:  email, smtp
Drymail
Makes sending emails easy and DRY — For Python 3.
Stars: ✭ 218 (-10.66%)
Mutual labels:  email, smtp
Mailinabox
Mail-in-a-Box helps individuals take back control of their email by defining a one-click, easy-to-deploy SMTP+everything else server: a mail server in a box.
Stars: ✭ 10,649 (+4264.34%)
Mutual labels:  email, smtp
Fluentemail
All in one email sender for .NET. Supports popular senders (SendGrid, MailGun, etc) and Razor templates.
Stars: ✭ 1,888 (+673.77%)
Mutual labels:  email, smtp

Build Status GoDoc

An elegant MIME mail library with support for attachments




A simple, easy to use email library for Go (golang).
  • Full attachment support (attach anything that implements io.Reader)
  • Send to multiple addresses at the same time, including BCC addresses.
  • Supports composing multi-part messages (HTML and plain text emails for older clients)
  • Write templates directly to the email body (implements io.Writer for convenience)
  • Production ready - several million emails sent in a production environment
  • SMTP over TLS support, with automatic STARTTLS upgrades for plaintext connections

Installation

If you're using go mod:

go get -v github.com/domodwyer/mailyak/v3

Or with GOPATH:

go get -v github.com/domodwyer/mailyak

Usage

// Create a new email - specify the SMTP host:port and auth (if needed)
mail := mailyak.New("mail.host.com:25", smtp.PlainAuth("", "user", "pass", "mail.host.com"))

mail.To("[email protected]")
mail.From("[email protected]")
mail.FromName("Bananas for Friends")

mail.Subject("Business proposition")

// mail.HTML() and mail.Plain() implement io.Writer, so you can do handy things like
// parse a template directly into the email body
if err := t.ExecuteTemplate(mail.HTML(), "htmlEmail", data); err != nil {
    panic(" 💣 ")
}

// Or set the body using a string setter
mail.Plain().Set("Get a real email client")

// And you're done! 
if err := mail.Send(); err != nil {
    panic(" 💣 ")
}

To send an attachment:

mail := mailyak.New("mail.host.com:25", smtp.PlainAuth("", "user", "pass", "mail.host.com"))

mail.To("[email protected]")
mail.From("[email protected]")
mail.Subject("I am a teapot")
mail.HTML().Set("Don't panic")

// input can be a bytes.Buffer, os.File, os.Stdin, etc.
// call multiple times to attach multiple files
mail.Attach("filename.txt", &input)

if err := mail.Send(); err != nil {
    panic(" 💣 ")
}

Notes

  • Why "MailYak"? Because "MailyMcMailFace" is annoyingly long to type.
  • You can use a single instance of mailyak to send multiple emails after changing the to/body/whatever fields, avoiding unnecessary allocation/GC pressure.
  • Attachments are read when you call Send() to prevent holding onto multiple copies of the attachment in memory (source and email) - this means changing the attachment data between calling Attach() and Send() will change what's emailed out!
  • For your own sanity you should vendor this, and any other libraries when going into production.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].