Click here to Skip to main content
12,447,778 members (61,575 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET MailSlot
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
Posted 14-May-12 21:26pm
Updated 14-May-12 21:27pm
uspatel30.3K
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160811.3 | Last Updated 15 May 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100