邮件发送失败错误msg事务失败。服务器响应为:5.7.1< unknown [192.168.140.116]>:客户端主机被拒绝:访问被拒绝 [英] mail sending failure error msg Transaction failed. The server response was: 5.7.1 <unknown[192.168.140.116]>: Client host rejected: Access denied

查看:921
本文介绍了邮件发送失败错误msg事务失败。服务器响应为:5.7.1< unknown [192.168.140.116]>:客户端主机被拒绝:访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi tech guys

i在通过我的C#代码发送邮件时遇到问题

此执行后抛出的错误消息是smClient.Send(Msg);

交易失败。服务器响应为:5.7.1< unknown [192.168.140.116]>:客户端主机被拒绝:拒绝访问

任何人都可以帮助我< br $> b $ b

hi tech guys
i am facing a issue while sending mail through my C# code
The error msg thrown after this this execution is smClient.Send(Msg);
"Transaction failed. The server response was: 5.7.1 <unknown[192.168.140.116]>: Client host rejected: Access denied"
can anybody help me

public string SendOTPEmail(string EmailID, string OTP, string UserName)
       {
           string status = string.Empty;
           string EmailSending_Status = string.Empty;
           string UserId = string.Empty;
           string PassWord = string.Empty;
           string EmailFrom = string.Empty;
           string SMTPHost = string.Empty;
           string EmailDomain = string.Empty;
           System.Net.Mail.MailMessage Msg = new System.Net.Mail.MailMessage();
           try
           {
               {
                   UserId = "xyz";
                   PassWord = "abc";
                   EmailFrom = "abc@aaa.com";
                   EmailDomain ="aaa.com";
                   NetworkCredential basicAuthenticationInfo = new NetworkCredential(UserId, PassWord, EmailDomain);
                   SMTPHost = "abc.com";
                   string EmailFromName = "aaa.aa@ssss.com";
                   Msg.Subject = "Please complete your customer registration";
                   Msg.From = new System.Net.Mail.MailAddress(EmailFrom, EmailFromName);
                   Msg.To.Add(new System.Net.Mail.MailAddress(EmailID));
                   Msg.IsBodyHtml = true;
                   Msg.Body = " Dear Sir/Madam," + "" + "<br>" +
                                   "" + "<br>" +
                                     "TATA AIG General Insurance welcomes you to its Portal." + "" + "<br>" +
                                    "Please enter the One Time Password:" + OTP + " to complete your Registration " + "" + "" + "<br>" +
                                    "This One Time Password is valid for 24 hours." + "" + "<br>" +
                                      "" + "<br>" +
                                     "" + "<br>" +
                                "Thanks and Regards" + "<br>" +
                               "Portal Admin" + "<br>" +
                                "" + "<br>" +
                                "" + "<br>" +
                                "" + "<br>" +
                                "Note: This is a system-generated e-mail. Please do not reply back.";
                   SmtpClient smClient = new SmtpClient();
                   smClient.Host = SMTPHost;
                   smClient.Port = 587;
                   smClient.EnableSsl = false;
                   smClient.UseDefaultCredentials = false;
                   smClient.Credentials = basicAuthenticationInfo;

                   if (ValidSMTP(SMTPHost))
                   {
                       smClient.Send(Msg);

                       EmailSending_Status = "sent";
                       status = "OTP sent to your Mailbox successfully.";
                   }
                   else
                   {
                       EmailSending_Status = "Mailserver Down";
                       status = "Failed";
                   }
               }
           }

           catch (SmtpException ex)
           {
               status = ex.Message;
               EmailSending_Status = "failed";
           }
           return status;
       }

推荐答案

这是与您的防火墙策略相关的内容,它不允许您发送该地区以外的邮件。

请在下面查看已解决此问题的链接。

http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/MS-SharePoint/Q_28477111.html [ ^ ]



http://forums.asp.net/t/1283299.aspx?Problem+with+sending+mail+using+smtp+server+in+c+net+ [ ^ ]



希望这对你有帮助。
It is something related to your firewall policy, which is not allowing you to send the mail outside the area.
Please check below links where this problem is been answered.
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/MS-SharePoint/Q_28477111.html[^]

http://forums.asp.net/t/1283299.aspx?Problem+with+sending+mail+using+smtp+server+in+c+net+[^]

Hope this will help you.


这篇关于邮件发送失败错误msg事务失败。服务器响应为:5.7.1&lt; unknown [192.168.140.116]&gt;:客户端主机被拒绝:访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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