Recently, due to the needs of an R & I project, users require that the system send an email reminder or send an email every Monday to automatically collect data, therefore, I also found relevant materials and wrote a Demo to share with you, so that
Recently due to a r&i project needs, user requirements in the purchase of products or shipments and other links, need to send an email alert or every Monday to let the system automatically collect data sent an e-mail, so I also find relevant
Recently in the mail to send the interface to the problems encountered and solutions to tell you want to know the message to help people
The original program part of the code is as follows
Set mail message sender address, recipient address,
This is a creation in
Article, where the information may have evolved or changed.
Struggle with the net/smtp of the Go language for a day and record the journey.
First, use the most standard example
Host: = Net. Joinhostport (hostnameport)
username
PackageCom.sm.modules.oa.web;Importjavax.mail.Session;ImportJavax.mail.Transport;Importjavax.mail.internet.InternetAddress;ImportJavax.mail.internet.MimeMessage;Importjava.util.Date;Importjava.util.Properties; Public classSend {//Sender's mailbox
Table (1) SMTP CodeCode definition421 service not available, hosts in the closing transmission channel brackets cannot provide normal services, close the transmission pipeline, and emails will be stuck on the host450 requested mail action not taken:
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.