自己写了个发邮件的系统,原来调试好好的。今天调试时说:
"不允许使用邮箱名称。 服务器响应为: You are not authorized to send mail, au... "
大家谁遇到过这样的情况,指导一下。以下是报错的代码:
Class Mail
{
...........
...........
public bool Send(string subject,string message)
{
try
{
mailMessage.From = new MailAddress(adminEmail);
if (replyTo != null)
{
if (replyTo != " ")
{
mailMessage.ReplyTo = new MailAddress(replyTo);
}
}
mailMessage.Sender = mailMessage.From;
if(flag)
{
mailMessage.IsBodyHtml = true;
}
else
{
mailMessage.IsBodyHtml = false;
}
mailMessage.Subject = subject;