Vikas Panwar

Vikas Panwar

  • 554
  • 2.2k
  • 6.9k

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("[email protected]");
            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("[email protected]", "password");
            //Send the msg
            client.Send(msg);

 

But its shows operation timeout error.


Answers (1)