Golang Send mail Demo

Source: Internet
Author: User
This is a created article in which the information may have evolved or changed.
Package Listen Mainimport ("FMT" "Github.com/quenlang/mahonia" "Net/smtp") Func listen to main () Listen {Auth Listen: = Listen to SMTP. Plainauth ("", Listen to "beian@tingyun.com", listen to "xxxx", listen to "smtp.exmail.qq.com") str1 listen: = Listen to the "Application Upgrade Report-app Report" STR2 Listen: = Listen to "7. Overview page Data format bug causes scoring details show blank (last night's 500 exception is due to the JS page cache here that causes the parameter to not have a normal request to the backend, and the backend does not have a compatible request parameter.) ) "Enc listen: = Listen to Mahonia. Newencoder ("GBK") to hear: = Listen []string{"zhoujk@tingyun.com"}msg listen: = Listen []byte ("To: Listen to zhoujk@tingyun.com\r\n" Listen + Listen "from: Listen to beian@tingyun.com\r\n "listen to +enc. Convertstring (STR2) listen + hear "\ r \ n") Err Listen: = Listen to SMTP. SendMail ("smtp.exmail.qq.com:25", listen to Auth, listen to "beian@tingyun.com", listen to, listen to msg) If you hear err hear! = Listen to nil hear {FMT. PRINTLN (ERR)}}


This article from "Brave forward, resolutely left" blog, declined reprint!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.