C#发送邮件保存eml 50
1个回答
展开全部
//这个是我自己做的一个QQ发邮件代码,注:ssl加密要到邮箱里发短信来获取密码(不是你的QQ密码)
//代码如下:
private bool SendMail(Form2.History hsSendInfo, string warning = null)
{
try
{
string HostName = System.Net.Dns.GetHostName();
string AddressIP = string.Empty;
string SystemTime = System.DateTime.Now.ToString();
string Address = GetAddress();
MailMessage mm = new MailMessage();
mm.From = new MailAddress(hsSendInfo.Account);
mm.To.Add(hsSendInfo.Exexplain);
mm.Subject = "登录信息提醒";
mm.Body = "XX";
mm.BodyEncoding = System.Text.Encoding.UTF8;
mm.IsBodyHtml = false;
SmtpClient sc = new SmtpClient();
NetworkCredential nc = new NetworkCredential();
nc.UserName = hsSendInfo.Account;
nc.Password = hsSendInfo.Password;
sc.UseDefaultCredentials = true;
sc.DeliveryMethod = SmtpDeliveryMethod.Network;
sc.Credentials = nc;
sc.Host = "smtp.qq.com";
sc.EnableSsl = true;
sc.Send(mm);
}
catch
{
return false;
}
return true;
}
//不明请追问
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询