Click here to Skip to main content
15,913,055 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I want to send a mail from my server, i used the following code but it produces the following error, kindly give me solution to correct it

Code Used:
C#
string s = "kishore";
MailMessage mail = new MailMessage();
mail.To = "kishorethoppil@gmail.com";
mail.From = "kishorethoppil@gmail.com";
mail.Subject = "House Boat Cruise";
mail.BodyFormat = MailFormat.Html;
mail.Body = s;
SmtpMail.SmtpServer = "mail.keratravels.com";
SmtpMail.Send(mail);
lblDisplay.Text = "Successfully Posted";


ERROR:
The server rejected one or more recipient addresses. The server response was: 503 This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server.
Posted
Updated 29-Jul-10 19:38pm
v2

The error is self explanatory. You have not provided the Authenticating Username/Password that will be used in order to access the account.

You need to make Web.Config changes.
Have a look here: Sending Email in ASP.NET 2.0 [^]
Something like:
XML
<configuration>
  <!-- Add the email settings to the <system.net> element -->
  <system.net>
    <mailSettings>
      <smtp>
        <network
             host="relayServerHostname"
             port="portNumber"
             userName="username"
             password="password" />
      </smtp>
    </mailSettings>
  </system.net>
  <system.web>
    ...
  </system.web>
</configuration>
 
Share this answer
 
Refer This [^]
 
Share this answer
 
If you are unable to solve an error in your own way, then second best way to troubleshoot an error is just search that error code in Google and get some expert's opinion. So always do an initial search before posting it somewhere in a forum.

Check if this link is useful for you,

http://weblogs.asp.net/gad/archive/2003/11/02/35288.aspx[^]
 
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