Void-voiD

Untitled

Oct 23rd, 2019
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.60 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "log"
  5.     "net/smtp"
  6. )
  7.  
  8. var (
  9.     host string
  10.     port string
  11.     login string
  12.     password string
  13. )
  14.  
  15. func SendMail() {
  16.     auth := smtp.PlainAuth("", login, password, host)
  17.     to := []string{"...@yandex.ru"}
  18.     msg := []byte(
  19.         "From: " + login + "\n" +
  20.         "To: ...@yandex.ru\r\n" +
  21.         "Subject: Try_0\r\n" +
  22.         "\r\n" +
  23.         "This is the email body, version_0.\r\n")
  24.     err := smtp.SendMail(host + ":" + port, auth, login, to, msg)
  25.     if err != nil {
  26.         log.Fatal(err)
  27.     }
  28. }
  29.  
  30. func main() {
  31.     host = "smtp.yandex.ru"
  32.     port = "465"
  33.     login = "...@yandex.ru"
  34.     password = "..."
  35.     SendMail()
  36. }
Add Comment
Please, Sign In to add comment