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

前端 未结 17 2605
醉话见心
醉话见心 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:48

    Initialize the MailMessage with sender and reciever's email addresses. It should be something like

    string from = "codeforwin@gmail.com";  //Senders email   
    string to = "reciever@gmail.com";  //Receiver's email  
    MailMessage msg = new MailMessage(from, to); 
    

    Read the full code snippet of how to send emails in c#

提交回复
热议问题