Click here to Skip to main content
11,631,896 members (71,252 online)
Rate this: bad
good
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
Edited 14-May-12 21:27pm
uspatel30K
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
0 OriginalGriff 8,393
1 Sergey Alexandrovich Kryukov 8,044
2 Mika Wendelius 6,260
3 F-ES Sitecore 2,321
4 Suvendu Shekhar Giri 1,970


Advertise | Privacy | Mobile
Web01 | 2.8.150728.1 | Last Updated 15 May 2012
Copyright © CodeProject, 1999-2015
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