Unable to send email using Realy server setup RRS feed

  • Question

  • User-36524715 posted

    Hi Team,

    I am using relay smtp setup to send email using SmtpClient using c#, when I use of SMTP name as .host property and 25 port i can able to send email

    but when I used relay server name as to set host property i got below error 

    below is my sample code(no sender password is used to send email)

    SmtpClient client = new SmtpClient();
     MailMessage msg = new MailMessage();
    client.Host = "Relay Servername/ or IP"; /// tried both 
    client.Port = 25;
    client.EnableSsl = false;
    client.DeliveryMethod = SmtpDeliveryMethod.Network;
    msg.Subject = "test subject";
    msg.Body =  "test body";
    msg.IsBodyHtml = true;

    Error :

    System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed.

    what more property need to set for this error

    Monday, November 9, 2020 11:31 AM

All replies

  • User475983607 posted

    The client cannot reach the IP or Host name.  There can be many reasons for the network error which is beyond the scope of these forums.  

    You need a networking or SMTP relay support forum. 

    Monday, November 9, 2020 12:41 PM
  • User1535942433 posted

    Hi sandipb,

    Accroding to your description,I'm guessing that if you are on a residential internet connection, quite often your ISP will block outgoing email sends by blocking all outbound connections to port 25. This is quite common here in the US. Try connecting to a local email server over TCP/IP, or to one on your own internal network.Or you could use port 587.

    Best regards,

    Yijing Sun

    Tuesday, November 10, 2020 5:25 AM