send mail to gmail ssl problem in c#
i try to send me an mail via c# but everytime it comes an ssl error. can you tell me whats wrong?
Thank you
SmtpClient mail = new SmtpClient();
MailMessage msg = new MailMessage("address", "address");
msg.Subject = "send data";
msg.Body = "Stuff";
mail.Credentials = new NetworkCredential("username", "pw");
mail.Host = "smtp.googlemail.com";
Attachment data = new Attachment(pat开发者_如何学Ch1);
msg.Attachments.Add(data);
Attachment data2 = new Attachment(path2);
msg.Attachments.Add(data2);
Attachment data3 = new Attachment(path3);
msg.Attachments.Add(data3);
mail.Send(msg);
mail.DeliveryMethod = SmtpDeliveryMethod.Network;
mail.EnableSsl = true;
mail.Port = 587;
it comes the error: Server answer: 5.3.2 Sorry, during probation period you are not allowed to use SMTP service {mp018}
From this error I'm assuming you've just signed up for the google account, and google is not allowing you to use its smtp service until its probation period is over. Find out how long the probation period is and try when its over
Try setting mail.EnableSsl
to true
.
精彩评论