从SMTP发送电子邮件时出错 [英] Error in Sending email from SMTP

查看:322
本文介绍了从SMTP发送电子邮件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面我在运行该代码时给出了我的代码,但出现错误交易失败.服务器响应为:由于政策原因,拒绝了来自itsupport@xxxxx.in的邮件."

hi below i have given my code when i run this code i get error "Transaction failed. The server response was: Mail from itsupport@xxxxx.in rejected for policy reasons."

Const ToAddress As String = "Diler_Patel@Yahoo.com"
        Dim mm As New MailMessage("itsupport@xxxxx.in", ToAddress)
               mm.Subject = "DemoSubject" 'subject.Text
        mm.Body = "DemoBody" 'body.Text
        mm.IsBodyHtml = False

        '(3) Create the SmtpClient object
        Dim smtp As New SmtpClient
        smtp.DeliveryMethod = SmtpDeliveryMethod.Network
        smtp.UseDefaultCredentials = False
        Dim basicAuthenticationInfo As New System.Net.NetworkCredential("itsupport@xxxxx.in", "password@123")
                smtp.Credentials = basicAuthenticationInfo
        smtp.Host = "xxxxx.in"

        smtp.Port = 25
        'smtp.EnableSsl = True
                smtp.Send(mm)



您能帮我这段代码有什么问题吗,如果我enableSsl = true而不是我得到错误服务器不支持安全连接"



can u help me whats wrong with this code and one more thing if i enableSsl = true than i get error "Server dose not support Secure Connection"

推荐答案

交易失败.服务器响应为:由于策略原因,拒绝了来自itsupport@xxxxx.in的邮件.
显然,这意味着您的电子邮件服务器不允许使用给定的电子邮件ID发送电子邮件,这是因为您的邮件服务器定义了用于发送电子邮件的策略.可能是由于任何原因违反了已定义的策略,例如以电子邮件形式发送exe文件或以电子邮件形式发送不适当的文本.可能还会发生用户凭据未被授权这样做的情况.

服务器不支持安全连接
有定义的SMTP端口允许安全连接.似乎未为使用的端口配置用于发送SSL电子邮件的端口.

确保已在Web.Config中正确配置了SMTP配置:
Transaction failed. The server response was: Mail from itsupport@xxxxx.in rejected for policy reasons.
It clearly means that your email server did not allow email to be sent from the given email ID because of the policies defined by your mail server for sending an email. It can be because of any reason against defined policy like sending an exe file in email or some text in the email which is not appropriate. It might also happen that the user credentials are not authorized to do so.

Server dose not support Secure Connection
There are defined SMTP ports that allow secure connection. Looks like the port used to send email for SSL is not configured for the used port.

Make sure you have configured SMTP configuration correctly in Web.Config:
<system.net>
   <mailSettings>
     <smtp from="abc@somedomain.com">
       <network host="somesmtpserver" port="25" userName="name" password="pass" defaultCredentials="true" />
     </smtp>
   </mailSettings>
</system.net>


如果需要,请查看此Microsoft Video教程:


If needed, have a look at this Microsoft Video tutorial: Use ASP.NET to send Email from Website[^]


您的服务器不支持SSL默认端口大多数人不会

显然这与SMTP服务器的配置有关.您将需要获取适当的凭据,或将SMTP服务器设置为允许从Web服务器发送邮件.
Your server does not support SSL on the default port; Most won''t

This is apparently an issue with how the SMTP server is configured. You will need to get appropriate credentials, or have the SMTP server set to allow mail to be sent from the web server.


尝试使用其他端口.由于安全原因,大多数管理员已启用其他端口.
请与您的网络管理员联系以获取SMTP端口号和正确的配置.
Try with Different Port. Due to security reasons, most of Admins have enabled other ports.
Contact your Network Administrator for SMTP Port number and proper configurations.


这篇关于从SMTP发送电子邮件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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