Hi
I m developing a desktop application using C#
I m trying to use gmail's smtp sever on port 587 but it is giving me an exception that target machine actively refuesd at 74.125.127.109: 587
Can any body help me plz...
My Code is:-
I m developing a desktop application using C#
I m trying to use gmail's smtp sever on port 587 but it is giving me an exception that target machine actively refuesd at 74.125.127.109: 587
Can any body help me plz...
My Code is:-
Code:
private void Button1_Click(object sender, EventArgs e)
{
SmtpClient SmtpServer = new SmtpClient();
SmtpServer.Credentials = new System.Net.NetworkCredential("mygmailid@gmail.com", "mypassword");
SmtpServer.Port = 587;
SmtpServer.Host = "smtp.gmail.com";
SmtpServer.EnableSsl = true;
mail = new MailMessage();
String[] addr = TextBox1.Text.Split(',');
try
{
mail.From = new MailAddress("mygmailid@gmail.com", "Developers", System.Text.Encoding.UTF8);
mail.Subject = TextBox3.Text;
mail.Body = TextBox4.Text;
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
mail.ReplyTo = new MailAddress(TextBox1.Text);
SmtpServer.Send(mail);
}
catch (Exception ex){
MessageBox.Show(ex.ToString());
}
}
Comment