Videos
Check out our tutorial video series.
Sending secure emails with Go's popular SMTP package using secure socket layer is easy with this tutorial. Learn how to do it with just a few steps!
Sending email over SMTP in go is easy. Go contains its own net/smtp package but it can be cumbersome. Luckily there exists the excellent open source emersion go-smtp package. In this post we will show you how to send email using SMTP commands in go.
Add the dependency to your go project. For this example we will also add MailSlurp to create an SMTP inbox for our test. We can find this at
.
Notice the package - we can use that to test our SMTP client code.
We need to send email with Go to and through email mailservers. We can do this if we know a mailservers port and host names. With MailSlurp we can generate a new disposable mailbox and use the details associated with it.
To send email safely with Go we should use TLS secure socket connections. We can do this like so:
If necessary we can also send emails with TLS using an insecure connection:
Check out our tutorial video series.
Email and SMS guides for automation and testing.
View github project code for multiple languages.
Latest posts from the MailSlurp team.
Test, build, and automate messaging with a free MailSlurp account.