Go語言smtp模塊發純文本文件

d66g 9年前發布 | 5K 次閱讀 Golang Go語言

    package main

import (  
    "fmt"  
    "net/smtp"  
)  

func main() {  
    auth := smtp.PlainAuth("text/plain", "fyxichen@163.com", "123456", "smtp.163.com")  
    to := []string{"123456@qq.com"}  
    msg := []byte(`To:123456@qq.com  
From:czxichen@163.com  
Subject:測試  
Content-Type: text/plain;  
charset=UTF-8"  

this is test mail`)  
    err := smtp.SendMail("smtp.163.com:25", auth, "fyxichen@163.com", to, msg)  
    fmt.Println(err)  
}  </pre> 


 本文由用戶 d66g 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!