无法通过 Godaddy 服务器在 ASP.NET 中发送电子邮件

2024-04-22

我有一个托管在 Godaddy 上的 ASP.NET 应用程序,我想从中发送电子邮件。当它运行时,我得到:不允许使用邮箱名称。服务器响应是:抱歉,您所在位置的中继被拒绝。代码和Web.config的重要部分如下:

msg = new MailMessage("[email protected] /cdn-cgi/l/email-protection", email);
        msg.Subject = "GreekTools Registration";
        msg.Body =
            "You have been invited by your organization to register for the GreekTools recruitment application.<br/><br/>" +
            url + "<br/><br/>" +
            "Sincerely,<br/>" +
            "The GreekTools Team";

        msg.IsBodyHtml = true;

        client = new SmtpClient();
        client.Host = "relay-hosting.secureserver.net";

        client.Send(msg);

<system.net>
<mailSettings>
  <smtp from="[email protected] /cdn-cgi/l/email-protection">
    <network host="relay-hosting.secureserver.net" port="25" userName="********" password="*********" />
  </smtp>
</mailSettings>

1-如果您的网站托管在 godaddy 上,您可以使用“relay-hosting.secureserver.net”而无需凭据。

2- 如果您的网站托管在 godaddy 之外,您可以使用“smtpout.secureserver.net”和您的电子邮件帐户凭据。

PS:如果25有问题请更换端口3535

托管在 GoDaddy 上

    <system.net>
      <mailSettings>
       <smtp from="[email protected] /cdn-cgi/l/email-protection">
        <network host="relay-hosting.secureserver.net"/>
       </smtp>
      </mailSettings>
    </system.net>

External

  <system.net>
    <mailSettings>
      <smtp from="[email protected] /cdn-cgi/l/email-protection">
        <network host="smtpout.secureserver.net" 
           userName="[email protected] /cdn-cgi/l/email-protection" password="your_password_here" 
           port="25" />
      </smtp>
    </mailSettings>
  </system.net>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法通过 Godaddy 服务器在 ASP.NET 中发送电子邮件 的相关文章

随机推荐