-1
protected void Button1_Click(object sender, EventArgs e)
{
  MailMessage message = new MailMessage("test@gmail.com", "test@gmail.com", "header", "detail");
  message.IsBodyHtml = true;

  SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
  client.DeliveryMethod = SmtpDeliveryMethod.Network;
  client.EnableSsl = true;
  client.Credentials = new System.Net.NetworkCredential("test@gmail.com", "1234");
  client.Send(message);
  Label1.Text = "SuccessFull";
}

This is the error message I get:

Service not available, closing transmission channel. The server response was: Server busy, closing transmission channel. Try again later

Filburt
  • 17,626
  • 12
  • 64
  • 115
Kim
  • 1
  • You should check the answers on [Sending email in .NET through Gmail](http://stackoverflow.com/q/32260/205233) and related posts. – Filburt Feb 28 '17 at 09:06
  • 4
    Possible duplicate of [Sending email in .NET through Gmail](http://stackoverflow.com/questions/32260/sending-email-in-net-through-gmail) – VDWWD Feb 28 '17 at 09:24

1 Answers1

0

I will reference you to this already existing post which explains briefly how to send an email using System.Net.Mail!

Furthermore after having followed the instructions on the link above be sure to check the option in this link for allowing google accessing your account to less trusted apps. It's at the bottom of the page: enter image description here

If you follow them step by step you' ll have no problem sending your email. If I helped you solve your problem please vote my answer.

Community
  • 1
  • 1
HelloIT
  • 172
  • 2
  • 22