程序编译的问题吧。不需要设置什么啊。
SmtpMail.SmtpServer = dt.Rows[0]["EmailSmtp"].ToString();
//发送邮件
try
{
MailMessage aMessage = new MailMessage();
aMessage.From = EmailUsername;
aMessage.To = ToEmail;
aMessage.Subject = SubjectStr;
aMessage.Body = MailContent;
aMessage.BodyFormat = MailFormat.Html;
aMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");//基本认证
aMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", EmailUsername);//邮箱帐号
aMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", EmailPassword);//邮箱密码
SmtpMail.Send(aMessage);
}
catch (Exception ex)
{
//MessageBox.Show(ex.ToString());
}
自己解决咯~