cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New

Unable to read data from the transport connection: The connection was closed.

Hi

I am getting an error message when sending a mail with SMTP client, 
My code snip  is as below 

public void SendEmail(Subscriber sub)
{
try
{
SmtpClient client = new SmtpClient("smtpout.asia.secureserver.net")
{
UseDefaultCredentials = false,
EnableSsl = false,
Credentials = new NetworkCredential("asda@domain.com", "****"),
Timeout = 1000000,
DeliveryMethod = SmtpDeliveryMethod.Network

};
client.ServicePoint.MaxIdleTime = 1;

MailMessage mailMessage = new MailMessage
{
From = new MailAddress("sadas@domain.com")
};

var htmlBody = ReadHtmlEmailTemplate(sub.Guid);
mailMessage.To.Add("dush88cco@gmail.com");
mailMessage.Body = htmlBody;
mailMessage.IsBodyHtml = true;
mailMessage.Subject = "asd iasoasod ppp";
client.Send(mailMessage);
}
catch (System.Exception ex)
{
throw ex;
}

}

 

Please help me to resolve this.

 

 

1 REPLY 1
Community Manager
Community Manager

Re: Unable to read data from the transport connection: The connection was closed.

Hi @Walas. Welcome to GoDaddy Community! If this is a script that is hosted on one of our hosting platforms, then I suggest sending through the server relay-hosting.secureserver.net instead. All email sent from our hosting platforms needs to go out that way. Hope that helps. 

 

JesseW - GoDaddy | Community Manager | 24/7 support available at x.co/247support | Remember to choose a solution and give kudos.