Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
gopkg.in/domodwyer/mailyak.v3
An elegant MIME mail library with support for attachments
io.Reader
)io.Writer
for
convenience)If you're using go mod
:
go get -v github.com/domodwyer/mailyak/v3
Or with GOPATH
:
go get -v github.com/domodwyer/mailyak
// 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("dom@itsallbroken.com")
mail.From("jsmith@example.com")
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("dom@itsallbroken.com")
mail.From("oops@itsallbroken.com")
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(" 💣 ")
}
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!This library is fully maintained.
The (relatively) small API/scope and many years spent maturing means it doesn't receive frequent code changes any more. Bug fixes are definitely accepted (and appreciated!), and you can consider this a stable and maintained library.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.