I'm doing a WebForm where the user can forward a selected e-mail. This is the method I'm using:
public bool SendEmail()
{
SmtpClient smtpServer = new SmtpClient("host");
try
{
smtpServer.Port = port;
smtpServer.Credentials = new NetworkCredential("user", "pass");
smtpServer.EnableSsl = false;
MailMessage msg = new MailMessage();
msg.To.Add(txtTo.Text);
msg.From = new MailAddress("address");
msg.IsBodyHtml = true;
msg.Subject = "FW: " + txtSubject.Text;
msg.Body = txtBody.Value;
//Sending email
smtpServer.Send(msg);
smtpServer.Dispose();
return true;
}
catch (Exception ex)
{
return false;
}
}
It's working just fine, but the thing is that this is basically copying the e-mail and sending to the address informed by the user. Is there a way to just forward the message, instead of copy and send a new one, using SmtpClient?