问题请教...急....
#region 邮件发送代码/// <summary>
/// SMTPMail 的摘要说明。
/// </summary>
public class SMTPMail
{
/// <summary>
/// 邮件发送方法
/// </summary>
/// <param name="StrForm">发信地址</param>
/// <param name="StrTo">收信地址</param>
/// <param name="StrTitle">邮件主题</param>
/// <param name="StrContent">邮件内容</param>
/// <returns>成功返回 True 否则 False</returns>
public static bool SendMail(string StrForm, string StrTo, string StrTitle, string StrContent)
{
try
{
MailMessage mail = new MailMessage();
mail.To = StrTo;
mail.From = StrForm;
mail.Subject = StrTitle;
mail.Body = StrContent;
mail.BodyFormat = MailFormat.Html;//设置为HTML格式
//设置为需要用户验证
//mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
////设置验证用户名(把my_username_here改为你的验证用户名)
//mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "");
////设置验证密码(把password改为你的验证密码)
//mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "");
SmtpMail.SmtpServer = "smtp.163.com";
//邮件服务器地址
SmtpMail.Send(mail);
return true;
}
catch (Exception e)
{
throw e;
}
}
}
#endregion
提示错误:{"服务器拒绝了发件人地址。服务器响应为: 553 Requested action not taken: Local user only,smtp12,wKjAELDLNgKU8+VG5xYSNQ==.53755S2 1189475220\r\n"},有没有谁知道是什么原因?该如何解决...?
--------------------编程问答-------------------- myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", SmtpNo);
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", SmtpPwd);
你的用户名密码没设置 --------------------编程问答-------------------- 想发匿名邮件啊?肯定要输入用户名和密码啊!
补充:.NET技术 , ASP.NET