Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "log"
- "net/smtp"
- )
- var (
- host string
- port string
- login string
- password string
- )
- func SendMail() {
- auth := smtp.PlainAuth("", login, password, host)
- to := []string{"...@yandex.ru"}
- msg := []byte(
- "From: " + login + "\n" +
- "To: ...@yandex.ru\r\n" +
- "Subject: Try_0\r\n" +
- "\r\n" +
- "This is the email body, version_0.\r\n")
- err := smtp.SendMail(host + ":" + port, auth, login, to, msg)
- if err != nil {
- log.Fatal(err)
- }
- }
- func main() {
- host = "smtp.yandex.ru"
- port = "465"
- login = "...@yandex.ru"
- password = "..."
- SendMail()
- }
Add Comment
Please, Sign In to add comment