1

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...

Community
  • 1
  • 1
DShah
  • 9,768
  • 11
  • 71
  • 127
  • Do you have access to the live server? – Joe Ratzer Aug 19 '11 at 10:14
  • No, i dont have access to server... Can i do programatically anything??? i have seen 1 previous post http://stackoverflow.com/questions/6262242/problem-with-google-apps-email-smtp-to-send-mails-from-website – DShah Aug 19 '11 at 10:44

1 Answers1

1

It might be a firewall issue on the live server. Try looking at what ports are blocked.

Joe Ratzer
  • 18,176
  • 3
  • 37
  • 51
  • I do not have access to server... Will this be useful to set some certificate issues... But this code is in C# so what could be vb code for the same... because delegate in this case is not working ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; }; – DShah Aug 19 '11 at 10:47
  • You don't actually need the ServerCertificateValidationCallback. Try it without that line. You can also ask your service provider if they are blocking that port. – Joe Ratzer Aug 19 '11 at 11:05
  • Also, try the following defaultCredentials="false" in the web.config – Joe Ratzer Aug 19 '11 at 11:06
  • in vb file i have already set default credentials = false.. should i also do that in web.config...?? well m try that also... – DShah Aug 19 '11 at 11:10
  • I should have to consider this as true answer as the Problem is from live server only...... Thanx – DShah Aug 25 '11 at 15:22