<legend id='7XawS'><style id='7XawS'><dir id='7XawS'><q id='7XawS'></q></dir></style></legend>

      <small id='7XawS'></small><noframes id='7XawS'>

      • <bdo id='7XawS'></bdo><ul id='7XawS'></ul>

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

      向本地域发送电子邮件

      时间:2023-10-05
        <bdo id='xaRsj'></bdo><ul id='xaRsj'></ul>

              <tbody id='xaRsj'></tbody>

            <tfoot id='xaRsj'></tfoot>

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

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

              • 本文介绍了向本地域发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个从网站发送电子邮件的简单方法:

                I've got a simple method to send emails from the website:

                ... // local vars
                using (var mail = new MailMessage(from, sendTo))
                {
                    using (var smtp = new SmtpClient())
                    {
                        mail.CC.Add(cc);
                        mail.Bcc.Add(bcc.Replace(";", ","));
                        mail.Subject = subject;
                        mail.Body = body;
                        mail.IsBodyHtml = html == -1;
                        mail.Priority = priority;
                        mail.BodyEncoding = mail.SubjectEncoding = mail.HeadersEncoding = Encoding.UTF8;                    
                
                        smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
                
                        try
                        {
                            if (mail.Body.IsNotEmpty())
                            {               
                                smtp.Send(mail);                
                            }
                        }
                        catch
                        {
                            smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                
                            try
                            {
                                if (mail.Body.IsNotEmpty())
                                {                   
                                    smtp.Send(mail);                    
                                }
                            }
                            catch(Exception e)
                            {               
                                // I log the error here
                            }
                        }
                    }
                }
                

                效果很好;但是,当发件人是 anything@domainname.com 而收件人是 bob@domainname.com 时,电子邮件会卡在 Dropinetpub/mailroot 目录的文件夹,并且从未发送给收件人.

                Which works great; however, when the sender is anything@domainname.com and the recipient is bob@domainname.com, the emails are getting stuck in the Drop folder of the inetpub/mailroot directory and never sent to the recipient.

                问题是 - 我怎样才能解决这个问题,以便能够向同一(本地)域中的人发送电子邮件?

                The question is - how I can get around this to be able to send emails to people on the same (local) domain?

                推荐答案

                我认为几乎可以肯定是邮件服务器配置问题.

                I think it is almost certainly a mail server configuration issue.

                根据 SmptClient.Send()文档 任何不正确的配置(主机、凭据、端口、SSL、防火墙、防病毒等)都应该抛出 InvalidOperationExceptionSmtpException.

                According to the SmptClient.Send() Documentation any incorrect configuration on your end (Host, Credentials, Port, SSL, Firewall, Anti-Virus etc) should throw an InvalidOperationException or a SmtpException.

                您可以使用相同的代码和配置发送外部邮件这一事实 - 这意味着您可以连接到邮件服务器,这也非常强烈地表明问题出在下游.

                The fact that you can send external mail using the same code and config - which means that you have connectivity to the mail server also very strongly suggests that the problem lies downstream.

                我过去曾在有不同邮件服务器用于内部和外部邮件传递的公司工作.

                I have worked at companies in the past that had different mail servers for internal and external mail delivery.

                可能值得考虑消息使用的凭据.也许您有一个规则,它只允许一个组(所有公司或类似的东西)的成员向内部地址发送邮件.您可以通过使用您的真实域凭据来检查这一点(并在测试后将其删除)

                It could be worth considering what Credentials are being used for the message. Perhaps you have a rule which only allows members of a group (All Company or something like that) to send mail to internals addresses. You could check this by using your real domain credentials (and removing them after the test)

                smtp.Credentials = new NetworkCredential("your.username", "your.password");
                

                无论哪种方式,如果没有产生异常,邮件应该已经在邮件服务器上接收到,并且由该服务器来决定传递.

                Either way if no exception is generated the message should have been received on the mail server, and it is up to that server to determine delivery.

                这篇关于向本地域发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:SMTP 错误:“客户端无权向此服务器提交邮件" 下一篇:SMTP 服务器需要安全连接或客户端未通过身份验证.

                相关文章

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

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

                    <bdo id='QJKb8'></bdo><ul id='QJKb8'></ul>
                  <legend id='QJKb8'><style id='QJKb8'><dir id='QJKb8'><q id='QJKb8'></q></dir></style></legend>