在asp.net中发送邮件错误 [英] mail sending in asp.net error

查看:106
本文介绍了在asp.net中发送邮件错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从服务器发送邮件,我使用了以下代码,但是会产生以下错误,请给我解决方案以进行纠正

使用的代码:

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:

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";



错误:
服务器拒绝了一个或多个收件人地址.服务器响应为:503尝试发送到非本地电子邮件地址时,此邮件服务器需要身份验证.请检查您的邮件客户端设置,或与管理员联系以验证是否为此服务器定义了域或地址.



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.

推荐答案

该错误不言自明.您尚未提供用于访问帐户的身份验证用户名/密码.

您需要进行Web.Config更改.
在这里查看:在ASP.NET 2.0中发送电子邮件 [
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:
<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>


请参阅此[

如果您无法以自己的方式解决错误,那就倒数第二解决错误的方法就是在Google中搜索该错误代码,然后征求专家的意见.因此,在将其发布到论坛中的某个位置之前,请始终进行初始搜索.

检查此链接是否对您有用,

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


这篇关于在asp.net中发送邮件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆