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.To.Add("xxxx")
msg.Subject = "test subject";
msg.Body = "test body";
msg.IsBodyHtml = true;
client.Send(msg);
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