/// <param name="UserMail">用户邮箱地址</param>
/// <param name="Title">标题</param>
/// <param name="strEmailBody">正文</param>
/// <returns>发送成功或失败(bool)</returns>
public static bool SendMailUseGmail(string UserMail, string Title, string strEmailBody)
{
MailMessage msg = new MailMessage();
msg.To.Add(UserMail);
msg.From = new MailAddress("发送人帐号", "主题", System.Text.Encoding.UTF8);
msg.Subject = Title;
msg.SubjectEncoding = System.Text.Encoding.UTF8;
msg.Body = strEmailBody;
msg.BodyEncoding = System.Text.Encoding.UTF8;
msg.IsBodyHtml = true;
msg.Priority = MailPriority.High;
SmtpClient client = new SmtpClient();
client.Credentials = new System.Net.NetworkCredential("发送人帐号", "密码");
client.Host = "smtp.163.com";
client.EnableSsl = true;
try
{
client.Send(msg);
return true;
}
catch (SmtpException ex)
{
return false;
}
}请问下这样发送邮件为什么有的时候非常慢,我想要发送然后马上就能到邮箱中收到邮件该怎么做呢?
求高人指教······
/// <param name="Title">标题</param>
/// <param name="strEmailBody">正文</param>
/// <returns>发送成功或失败(bool)</returns>
public static bool SendMailUseGmail(string UserMail, string Title, string strEmailBody)
{
MailMessage msg = new MailMessage();
msg.To.Add(UserMail);
msg.From = new MailAddress("发送人帐号", "主题", System.Text.Encoding.UTF8);
msg.Subject = Title;
msg.SubjectEncoding = System.Text.Encoding.UTF8;
msg.Body = strEmailBody;
msg.BodyEncoding = System.Text.Encoding.UTF8;
msg.IsBodyHtml = true;
msg.Priority = MailPriority.High;
SmtpClient client = new SmtpClient();
client.Credentials = new System.Net.NetworkCredential("发送人帐号", "密码");
client.Host = "smtp.163.com";
client.EnableSsl = true;
try
{
client.Send(msg);
return true;
}
catch (SmtpException ex)
{
return false;
}
}请问下这样发送邮件为什么有的时候非常慢,我想要发送然后马上就能到邮箱中收到邮件该怎么做呢?
求高人指教······
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货