title: Allow null for To, Cc, Bcc of mailmessage (system.net.mail.mailmessage)
body: <p>I am using System.Net.Mail.MailMessage  to capture and pass it over the info related to email.</p>
  
  <p>I am getting "Value Cannot be null" exception. </p>
  
  <p>My requirement is anyone of the To,Cc,Bcc can be empty but at least one of those fields should have an email (either To or Cc or Bcc).</p>
  
  <p>Here is my code :</p>
  
  <pre><code>public object InsertMailSendQueue([FromBody] EmailReport mailMsg ) 
          {            
  
              mailMessage.To.Add(mailMsg.To);
              mailMessage.CC.Add(mailMsg.Cc);
              mailMessage.Bcc.Add(mailMsg.Bcc);
  
              mailMessage.From = new System.Net.Mail.MailAddress(mailMsg.From);
              mailMessage.Subject = mailMsg.Subject;
              mailMessage.Body = mailMsg.Body;
  
              var confirmation = EmailService.InsertMailSendQueue(mailMsg.AgentId, mailMsg.Notes, null, mailMessage, true);
              return confirmation;
  
          }    
  </code></pre>