I am getting error "operation time out"and it throws me to the exception when i am sending email through my smtp server.I am using the code with gmail smtp and the same code works fine.In smtp details I am using network credential as my username and password i got when i created my email account on my domain and outgoing server and smtp port. following is my code..
protected void send_Click(object sender, EventArgs e)
{
string to = "xyz@gmail.com"; //To address
string from = "xyz@gmail.com"; //From address
MailMessage message = new MailMessage(from, to);
string mailbody = "Welcome to gmail...";
message.Subject = "Sending Email";
message.Body = mailbody;
message.IsBodyHtml = true;
SmtpClient client = new SmtpClient("server host",port);
System.Net.NetworkCredential basicCredential1 = new
System.Net.NetworkCredential("Username ","Password");
client.EnableSsl = true;
//client.Timeout = 10000;
client.UseDefaultCredentials =false;
client.Credentials = basicCredential1;
try
{
client.Send(message);
}
catch (Exception ex)
{
throw ex;
}
}