//失败demo
//注:网上流行的.Net SSL发送邮件 本地成功,服务器成功不了,回提示远程失败
//成功的demo
web.config配置
<configuration>下
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="***邮箱***">
<network host="smtp.exmail.qq.com" port="465" userName="***邮箱***" password="**密码**" />
</smtp>
</mailSettings>
</system.net>
public static bool SendMail2(string toemail, string title, string body)
{
//读取web.config中配置
SmtpSection cfg = NetSectionGroup.GetSectionGroup(WebConfigurationManager.OpenWebConfiguration("~/web.config")).MailSettings.Smtp;
System.Web.Mail.MailMessage _mailMessage = new System.Web.Mail.MailMessage();
_mailMessag