文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>【C#使用Gmail发送邮件源代码分享】

【C#使用Gmail发送邮件源代码分享】

时间:2011-06-13  来源:zhxhdean

   using System.Net.Mail;                    try
{
MailMessage mailMessage
= new MailMessage();
mailMessage.To.Add(email);
mailMessage.From
= new System.Net.Mail.MailAddress("发送邮箱");
mailMessage.Subject
= Title;
mailMessage.Body
= Content;
mailMessage.IsBodyHtml
= true;
mailMessage.BodyEncoding
= System.Text.Encoding.UTF8;
mailMessage.Priority
= System.Net.Mail.MailPriority.Normal;

SmtpClient smtpClient
= new SmtpClient("587");
smtpClient.EnableSsl
= true;
smtpClient.Credentials
= new System.Net.NetworkCredential("帐号", "密码");
smtpClient.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtpClient.Host
= "smtp.gmail.com";
smtpClient.Send(mailMessage);
}
catch (Exception e)
{
throw e;
}
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载