//
public bool SendEmail()
{
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
msg.To.Add("1158694377@qq.com");//收件人地址
msg.CC.Add("1158694377@qq.com");//抄送人地址
msg.From = new System.Net.Mail.MailAddress("1206377426@qq.com", "Edward");//发件人邮箱,名称
msg.Subject = "This is a test email from QQ";//邮件标题
msg.SubjectEncoding = System.Text.Encoding.UTF8;//标题格式为UTF8
msg.Body = "郭郭";//邮件内容
msg.BodyEncoding = Encoding.UTF8;//内容格式为UTF8
SmtpClient client = new SmtpClient();
client.Host = "smtp.qq.com";//SMTP服务器地址
client.Port = 587;//SMTP端口,QQ邮箱填写587
client.EnableSsl = true;//启用SSL加密
//发件人邮箱账号,授权码(注意此处,是授权码你需要到qq邮箱里点设置开启Smtp服务,然后会提示你第三方登录时密码处填写授权码)
client.Credentials = new System.Net.NetworkCredential("1206377426@qq.com", "password");
try
{
client.Send(msg);//发送邮件
}
catch (Exception)
{
return false;
}
return true;
}
//调用上面方法(发送人需要开启POP3/SMTP服务)
SendEmail();
//详细说明