Search This Blog

Monday 31 December 2012

You work in a company, and need to send an email to a user, and a copy of that email to your manager. Which code should you use?


A.  MailMessage msg = new MailMessage();
msg.From = "from@yourcompany.com";
msg.To = "to@to.com, manager@yourcompany.com";
msg.Subject = "...";
msg.Body = "...";
SmtpClient client = new SmtpClient();
client.Send(msg);
B.  MailMessage msg = new MailMessage("from@yourcompany.com", "to@to.com");
msg.CC.Add(new MailAddress("manager@yourcompany.com"));
msg.Subject = "...";
msg.Body = "...";
SmtpClient client = new SmtpClient();
client.Send(msg);
C.  MailMessage msg = new MailMessage("from@yourcompany.com", "to@to.com");
msg.CC.Add(new MailAddress("manager@yourcompany.com"));
msg.Subject = "...";
msg.Body = "...";
SmtpClient client = new SmtpClient();
msg.Send(client);
D.  MailMessage msg = new MailMessage();
msg.From = "from@yourcompany.com";
msg.To = "to@to.com, manager@yourcompany.com";
msg.Subject = "...";
msg.Body = "...";
SmtpClient client = new SmtpClient();
msg.Send(client);

No comments:

Post a Comment