# Send an email in Go with smtp.SendMail

DevFeed: [Send an email in Go with smtp.SendMail](<https://devfeed.tech/articles/send-an-email-in-go-with-smtp-sendmail-22052.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2013/06/send-email-in-go-with-smtpsendmail.html>)

Published: 2013-06-13T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Code](<https://devfeed.tech/topics/code.md>), [Exception](<https://devfeed.tech/topics/exception.md>)

Tags: [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [blog](<https://devfeed.tech/tags/blog.md>), [code](<https://devfeed.tech/tags/code.md>), [exception](<https://devfeed.tech/tags/exception.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [library](<https://devfeed.tech/tags/library.md>), [programming](<https://devfeed.tech/tags/programming.md>), [standard-library](<https://devfeed.tech/tags/standard-library.md>)

## AI overview

This tutorial shows how to send email from Go using the net/smtp package and smtp.SendMail. It provides sample code for SMTP authentication, HTML message formatting, and error and panic handling when sending email after a critical exception.

## Source excerpt

I wanted to send an email from my TraceLog package when a critical exception occurred. Fortunately Go's standard library has a package called smpt which can be found inside the net package. When you look at the documentation you are left wanting. I spent 20 minutes researching how to use this package. After fighting through the parameters and bugs, I came up with this sample code: