How to send mail for .org domain using web mail service in asp.net

2.5k Views Asked by At

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("[email protected]");
    msg.To.Add("[email protected]");
    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("[email protected]");
    msg.To.Add("[email protected]");
    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
1

There are 1 best solutions below

0
On

Try testing the SMTP settings using something like Telnet, that'll tell you if you've got the right details.

Try something like this http://support.microsoft.com/kb/153119