Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

C#
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
C#
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:



CSS
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
Posted
Updated 14-May-12 21:27pm
v2

1 solution

Check
support@mydomain.org is valid mail id.

and
mail.mydomain.org is SMTP Server.
It may be that

mail.mydomain.com works as SMTP Server but org not.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900