在服务器 smtp 上发布 ASP.NET 网站后,电子邮件未发送...可能是什么问题?
我用VB语言编写了在ASP.NET中发送电子邮件的代码。我已经在本地主机上对其进行了测试,并且我的电子邮件正常工作。我正在使用 Gmail 设置通过 smtp.gmail.com 和 587 端口号发送电子邮件。但是当我发布网站时,电子邮件没有发送。可能是什么问题?会不会是服务器问题??
编辑 Google Apps email/smtp 发送邮件时出现问题来自网站 正如此链接中给出的,我
Public Class clsSSL
Public Function AcceptAllCertifications(ByVal sender As Object, ByVal certification As System.Security.Cryptography.X509Certificates.X509Certificate, ByVal chain As System.Security.Cryptography.X509Certificates.X509Chain, ByVal sslPolicyErrors As System.Net.Security.SslPolicyErrors) As Boolean
Return True
End Function
End Class
在同一个 vb 文件中尝试了下面的代码新类,我将其称为如下...这在本地主机上运行良好。
ServicePointManager.ServerCertificateValidationCallback = AddressOf New clsSSL().AcceptAllCertifications
但是我遇到了安全异常,如下所示
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
解决方案可能是什么
编辑2
我在 godaddy.com 上共享托管。我可以更改该帐户中有关 smtp.gmail.com 或端口号的某些设置吗???我完全不知道如何更改设置...
I have written code to send Email in ASP.NET with VB language. I have tested it on local host and my email is working. I am using Gmail settings for sending email with smtp.gmail.com and 587 port number. But when i have published the website Email is not sent. What could be the problem?? will it be a server problem??
EDIT
Problem with Google Apps email/smtp to send mails from website
as given in this link i have tried below code
Public Class clsSSL
Public Function AcceptAllCertifications(ByVal sender As Object, ByVal certification As System.Security.Cryptography.X509Certificates.X509Certificate, ByVal chain As System.Security.Cryptography.X509Certificates.X509Chain, ByVal sslPolicyErrors As System.Net.Security.SslPolicyErrors) As Boolean
Return True
End Function
End Class
new class in same vb file which i called it as below... this works well on local host..
ServicePointManager.ServerCertificateValidationCallback = AddressOf New clsSSL().AcceptAllCertifications
But i got security exception as below
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
What could be the solution
EDIT 2
I have shared hosting on godaddy.com. Can i change some setting regarding smtp.gmail.com or port number in that account??? I dont exactly know how to change settings...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能是实时服务器上的防火墙问题。尝试查看哪些端口被阻止。
It might be a firewall issue on the live server. Try looking at what ports are blocked.