1
發送電子郵件我有不使用加密連接的SMTP帳戶。我可以使用相同的帳戶發送從C#和Python的電子郵件沒有問題,但與去我得到的錯誤: 未加密的連接通過未加密的連接
這是我使用的代碼:
package main
import (
"log"
"net/smtp"
)
func main() {
// Set up authentication information.
auth := smtp.PlainAuth(
"",
"[email protected]",
"password",
"mail.example.com",
)
// Connect to the server, authenticate, set the sender and recipient,
// and send the email all in one step.
err := smtp.SendMail(
"mail.example.com:25",
auth,
"[email protected]",
[]string{"[email protected]"},
[]byte("This is the email body."),
)
if err != nil {
log.Fatal(err)
}
}