无法从asp.net发送电子邮件

时间:2012-09-29 15:20:34

标签: asp.net .net

它适用于特定的电子邮件地址,但其余的电子邮件不起作用。以下错误显示:

Server Error in '/RealTimeArsenicDataVisualizer' Application.
Mailbox name not allowed. The server response was: From address not verified - see http://help.yahoo.com/l/us/yahoo/mail/original/manage/sendfrom-07.html 

我的代码:

 System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("smtp.mail.yahoo.co.in", 587);

        client.UseDefaultCredentials = false;
     client.Credentials = new System.Net.NetworkCredential(emailid, password);

            client.Port = 587;

            client.Host = "smtp.mail.yahoo.co.in";

            client.EnableSsl = false;

            object userstate = msg;

            client.Send(msg);

1 个答案:

答案 0 :(得分:0)

将您的代码更改为:

client.Port = 465;

client.Host = " smtp.mail.yahoo.com";
client.EnableSsl = true;