Vikas Panwar

Vikas Panwar

  • 887
  • 1.8k
  • 1.3k

Operation Timeout Error when Sending Email In C# Via GoDaddy Mail

Nov 13 2021 9:25 AM

I want to send email thorw my godaddy email Server, I using this code 

   MailMessage msg = new MailMessage();
            msg.To.Add(txtemail.Text.Trim());
            MailAddress address = new MailAddress("abc@domain.com");
            msg.From = address;
            msg.Subject = "Email";
            string htmlBody = @"
                <!DOCTYPE html>
                <html>
                <head>
                    <title>Email</title>                
                </head>
                <body>
                    <h1> Hi welcome </h1>
                    <p> Thank you for register</p>
                </body>
                </html>

            msg.Body = htmlBody;
            msg.IsBodyHtml = true;
            SmtpClient client = new SmtpClient();
            client.Host = "smtpout.secureserver.net";
            client.Port = 465;
            client.UseDefaultCredentials = false;
            client.Credentials = new System.Net.NetworkCredential("abc@domain.com", "password");
            //Send the msg
            client.Send(msg);

 

But its shows operation timeout error.


Answers (1)