Last active
July 19, 2025 18:39
-
Star
(105)
You must be signed in to star a gist -
Fork
(26)
You must be signed in to fork a gist
-
-
Save jpillora/cb46d183eca0710d909a to your computer and use it in GitHub Desktop.
Revisions
-
jpillora revised this gist
Mar 28, 2015 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,6 +25,7 @@ func send(body string) { if err != nil { log.Printf("smtp error: %s", err) return } log.Print("sent, visit http://foobarbazz.mailinator.com") -
jpillora created this gist
Mar 28, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ package main import ( "log" "net/smtp" ) func main() { send("hello there") } func send(body string) { from := "[email protected]" pass := "..." to := "[email protected]" msg := "From: " + from + "\n" + "To: " + to + "\n" + "Subject: Hello there\n\n" + body err := smtp.SendMail("smtp.gmail.com:587", smtp.PlainAuth("", from, pass, "smtp.gmail.com"), from, []string{to}, []byte(msg)) if err != nil { log.Printf("smtp error: %s", err) } log.Print("sent, visit http://foobarbazz.mailinator.com") }