程序博客网 > 淘宝下拉框词一键提取
来源:互联网 发布:淘宝下拉框词一键提取 编辑:程序博客网 时间:2024/06/05 16:43
bool SendMail(string userName, string passWord, string from, string to, string subject, string body) { System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587); smtp.Credentials = new NetworkCredential(userName, passWord); smtp.EnableSsl = true; System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(new System.Net.Mail.MailAddress(from), new System.Net.Mail.MailAddress(to)); message.BodyEncoding = System.Text.Encoding.UTF8;//可以设置内容的编码方式 message.SubjectEncoding = System.Text.Encoding.UTF8; message.Body = body;//邮件内容 message.Subject = subject;//邮件标题 try { smtp.Send(message); return true; } catch { return false; } }