Why do I get “'property cannot be assigned” when sending an SMTP email?

前端 未结 17 2254
醉话见心
醉话见心 2020-11-22 05:50

I can\'t understand why this code is not working. I get an error saying property can not be assigned

MailMessage mail = new MailMessage();
SmtpClient client          


        
17条回答
  •  一向
    一向 (楼主)
    2020-11-22 06:36

    smtp.Host = "smtp.gmail.com"; // the host name
    smtp.Port = 587; //port number
    smtp.EnableSsl = true; //whether your smtp server requires SSL
    smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
    smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
    smtp.Timeout = 20000;
    

    Go through this article for more details

提交回复
热议问题