0

I want to send email from my asp.net application

I have successfully sent the email form my aspx page for .com domain

by the following code

    MailMessage msg = new MailMessage();
    msg.From = new MailAddress("support@mydomain.com");
    msg.To.Add("recipiant@gmail.com");
    msg.Subject = "Demo Subject";
    msg.Body = "Hey Test email";        
    SmtpClient client = new SmtpClient();
    client.Host = "mail.mydomain.com";
    client.Port = 25;
    client.Credentials = new NetworkCredential("username", "password");        
    client.Send(msg);

But in case of .org domain it is not going email I have used the below code for .org domain

    MailMessage msg = new MailMessage();
    msg.From = new MailAddress("support@mydomain.org");
    msg.To.Add("recipiant@gmail.com");
    msg.Subject = "Demo Subject";
    msg.Body = "Hey Test email";        
    SmtpClient client = new SmtpClient();
    client.Host = "mail.mydomain.org";
    client.Port = 25;
    client.Credentials = new NetworkCredential("username", "password");        
    client.Send(msg);

In user name filed i have entered only user name not with domain name.

so first sent when i have used for .com domain

but when i have used .org mail with correct id and password, then one error is throwing me, called:

Mailbox unavailable. The server response was: Authentication is required for relay Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: Authentication is required for relay
4

1 回答 1

0

尝试使用 Telnet 之类的工具测试 SMTP 设置,它会告诉您是否获得了正确的详细信息。

试试这样的http://support.microsoft.com/kb/153119

于 2012-05-15T08:05:31.263 回答