1

I'm using .NET 4.5 SmtpClient, as i found out, that everything on port 465 just returns time out, my question is, is there a way to send emails with port 465 on .NET 4.5

        SmtpClient c = new SmtpClient();
        c.Host = "smtp.gmail.com";
        c.Port = 465; //587;
        c.EnableSsl = true;
        c.DeliveryMethod = SmtpDeliveryMethod.Network;
        c.UseDefaultCredentials = false;
        c.Credentials = new System.Net.NetworkCredential(username, password);

        c.Send(from, to, "test", "testtt");

        Console.WriteLine("Its ok");
        Console.ReadLine();
pravprab
  • 2,301
  • 3
  • 26
  • 43
zPrima
  • 727
  • 1
  • 8
  • 20
  • Have you tried using Wireshark to work out what's going on? Is it possible that you've got a virus checker which is trying to proxy SMTP? (I've certainly seen that before, although whether it would work over SSL I'm not sure...) – Jon Skeet Feb 12 '14 at 18:18
  • This sounds like an AV / firewall issue. Try doing a telnet to that server/port from your server and see if you can get a response. – CtrlDot Feb 12 '14 at 18:21
  • may be this link could be of some help- http://stackoverflow.com/questions/1011245/how-can-i-send-emails-through-ssl-smtp-with-the-net-framework – HappyLee Feb 12 '14 at 18:25
  • telneting port 465, returns blank. seems i found out that System.Net.Mail will never support implicit SSL, it's by design. http://blogs.msdn.com/b/webdav_101/archive/2008/06/02/system-net-mail-with-ssl-to-authenticate-against-port-465.aspx – zPrima Feb 12 '14 at 18:33
  • from 2008 till today, nobody at microsoft implemented implicit SSL support in .net, or what? – zPrima Feb 12 '14 at 18:35
  • Looks like you should be using `System.Web.Mail` namespace instead. – Adam Modlin Feb 12 '14 at 19:10
  • Don't like to use deprecated/obsolete methods, but i guess that's the only way. – zPrima Feb 12 '14 at 19:27
  • You can use one of third-party clients. Rebex had something, if memory serves, and our SecureBlackbox has a powerful SMTP client component as well. – Eugene Mayevski 'Callback Feb 13 '14 at 06:08

0 Answers0