简体   繁体   中英

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(path1);
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

尝试将mail.EnableSsl设置为true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM