• <i id='ZRG5U'><tr id='ZRG5U'><dt id='ZRG5U'><q id='ZRG5U'><span id='ZRG5U'><b id='ZRG5U'><form id='ZRG5U'><ins id='ZRG5U'></ins><ul id='ZRG5U'></ul><sub id='ZRG5U'></sub></form><legend id='ZRG5U'></legend><bdo id='ZRG5U'><pre id='ZRG5U'><center id='ZRG5U'></center></pre></bdo></b><th id='ZRG5U'></th></span></q></dt></tr></i><div id='ZRG5U'><tfoot id='ZRG5U'></tfoot><dl id='ZRG5U'><fieldset id='ZRG5U'></fieldset></dl></div>
    <tfoot id='ZRG5U'></tfoot>

      • <bdo id='ZRG5U'></bdo><ul id='ZRG5U'></ul>

        <small id='ZRG5U'></small><noframes id='ZRG5U'>

        <legend id='ZRG5U'><style id='ZRG5U'><dir id='ZRG5U'><q id='ZRG5U'></q></dir></style></legend>
      1. .NET SMTP 客户端 - 客户端无权作为此发件人发送

        时间:2023-10-05
          <tbody id='ZqgtW'></tbody>

          <tfoot id='ZqgtW'></tfoot>
            <bdo id='ZqgtW'></bdo><ul id='ZqgtW'></ul>

            <i id='ZqgtW'><tr id='ZqgtW'><dt id='ZqgtW'><q id='ZqgtW'><span id='ZqgtW'><b id='ZqgtW'><form id='ZqgtW'><ins id='ZqgtW'></ins><ul id='ZqgtW'></ul><sub id='ZqgtW'></sub></form><legend id='ZqgtW'></legend><bdo id='ZqgtW'><pre id='ZqgtW'><center id='ZqgtW'></center></pre></bdo></b><th id='ZqgtW'></th></span></q></dt></tr></i><div id='ZqgtW'><tfoot id='ZqgtW'></tfoot><dl id='ZqgtW'><fieldset id='ZqgtW'></fieldset></dl></div>

              <small id='ZqgtW'></small><noframes id='ZqgtW'>

                1. <legend id='ZqgtW'><style id='ZqgtW'><dir id='ZqgtW'><q id='ZqgtW'></q></dir></style></legend>
                  本文介绍了.NET SMTP 客户端 - 客户端无权作为此发件人发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当我尝试通过 ASP MVC3 项目使用 SmtpClient 类发送电子邮件时,我的服务器上出现了奇怪的情况.这是我正在使用的代码.

                  I'm getting strange occurance on our servers when I am trying to send an email using SmtpClient class via an ASP MVC3 project. This is the code I am using.

                  try
                  {
                      var client = new SmtpClient("MailServer");
                      client.UseDefaultCredentials = true;
                  
                      MailMessage message = new MailMessage("me@mydomain.com", "friend@mydomain.com", "Test Message", "Test Body");
                      client.Send(message);
                  }
                  catch (Exception ex)
                  {
                      // Do Nothing
                  }
                  

                  我已经部署在三个环境中;在 Windows 7(使用 VS 2010 IIS)上它发送电子邮件正常,在 Windows 2003 IIS6 机器上它发送电子邮件正常,最后在 Windows 2008 R2 II7 服务器上我收到以下错误:

                  I have deployed on three environments; on Windows 7 (using VS 2010 IIS) it sends the email fine, on the Windows 2003 IIS6 machine it sends the email fine, finally on the Windows 2008 R2 II7 server I get the following error:

                  Mailbox unavailable. The server response was: 5.7.1 Client does not have permissions to send as this sender using username 
                  

                  任何人都可以就可能导致此问题的原因提出建议.我注意到当我查看 User.Identity.Name 时,返回的是一个空字符串.

                  Can anybody advise on what may be causing this. I have noticed that when I view User.Identity.Name, this is returning an empty string.

                  推荐答案

                  邮件服务器可能不支持发送匿名邮件,需要指定在邮件服务器上注册的凭据.

                  It is likely that the mail server does not support sending anonymous emails and will require credentials to be specified which are registered on the mail server.

                  您可以像这样指定凭据:

                  You can specify the credentials like so:

                  client.UseDefaultCredentials = false;
                  client.Credentials = new System.Net.NetworkCredential("username", "password");
                  

                  希望这会有所帮助.

                  这篇关于.NET SMTP 客户端 - 客户端无权作为此发件人发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 C# 查找 MX 记录? 下一篇:如何在 Asp.Net 中发送带附件的电子邮件

                  相关文章

                  1. <legend id='cRxhq'><style id='cRxhq'><dir id='cRxhq'><q id='cRxhq'></q></dir></style></legend>
                    <i id='cRxhq'><tr id='cRxhq'><dt id='cRxhq'><q id='cRxhq'><span id='cRxhq'><b id='cRxhq'><form id='cRxhq'><ins id='cRxhq'></ins><ul id='cRxhq'></ul><sub id='cRxhq'></sub></form><legend id='cRxhq'></legend><bdo id='cRxhq'><pre id='cRxhq'><center id='cRxhq'></center></pre></bdo></b><th id='cRxhq'></th></span></q></dt></tr></i><div id='cRxhq'><tfoot id='cRxhq'></tfoot><dl id='cRxhq'><fieldset id='cRxhq'></fieldset></dl></div>

                      <bdo id='cRxhq'></bdo><ul id='cRxhq'></ul>

                  2. <small id='cRxhq'></small><noframes id='cRxhq'>

                    <tfoot id='cRxhq'></tfoot>