1

I am trying to send email from C#.net and getting following error:-

Unable to read data from the transport connection: net_io_connectionclosed.

Same code is working fine with port: 25, but throwing error when update to port: 465

I have tested the SMTP settings with port 465 in Outlook and it works fine. Only have issue while sending through C#.

I am using following email settings.

  <mailSettings>
      <smtp from="info@domain.com" deliveryMethod="Network"  >
        <network host="mail.domain.com" password="xxx" port="465" userName="info@domain.com" enableSsl="true"  />
      </smtp>
    </mailSettings>
Lucifer
  • 29,392
  • 25
  • 90
  • 143
Harvinder
  • 91
  • 2
  • 10
  • Did you try port 587 instead? Normally thats the one you'd use for sending mail via SSL. Also pls post your email creation/dispatch code. – steve cook May 05 '14 at 04:03
  • I am using following code:- MailMessage message = new MailMessage(); message.To.Add("abc@domain.com"); message.Body = "Test"; message.Subject = "test"; new SmtpClient().Send(message); – Harvinder May 05 '14 at 04:24
  • With Port 587:- Error:- Unable to connect to the remote server – Harvinder May 05 '14 at 04:26

2 Answers2

0

System.Net.Mail.SmtpClient does not support Implicit SSL. Using old component System.Web.Mail is working fine.

How can I send emails through SSL SMTP with the .NET Framework?

Harvinder
  • 91
  • 2
  • 10
0

Use port 25 with SSL enable. It's worked for me.

cigien
  • 57,834
  • 11
  • 73
  • 112
  • 2
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 10 '22 at 20:51
  • 1
    This isn’t a terribly satisfying answer, and might not really be much of an answer at all. They already know that it works on Port 25. But they want to get it to work on Port 465. I don’t know those reasons, but there are any number of reasons they may have for necessitating or desiring that. – Jeremy Caney Jan 11 '22 at 00:36