有什么方法可以配置转发电子邮件地址,例如System.Net.Mail.MailMessage中的Replyto? 如果没有,我有什么办法可以实现?
答案 0 :(得分:0)
您只能通过Outlook(使用互操作)来做到这一点
var newItem = mailItem.Forward();
newItem.Recipients.Add("test@test.be");
newItem.Send();
here被描述为.Forward()
答案 1 :(得分:0)
答案 2 :(得分:0)
MailMessage中没有“转发”(这取决于接收邮件的用户)。
但是您可以使用multiple
或CC
属性,一次发送给BCC
收件人。
以下是使用CC
的一个示例:
public static void CreateCopyMessage(string server)
{
MailAddress from = new MailAddress("ben@contoso.com", "Ben Miller");
MailAddress to = new MailAddress("jane@contoso.com", "Jane Clayton");
MailMessage message = new MailMessage(from, to);
// message.Subject = "Using the SmtpClient class.";
message.Subject = "Using the SmtpClient class.";
message.Body = @"Using this feature, you can send an email message from an application very easily.";
// Add a carbon copy recipient.
MailAddress copy = new MailAddress("Notification_List@contoso.com");
message.CC.Add(copy);
SmtpClient client = new SmtpClient(server);
// Include credentials if the server requires them.
client.Credentials = CredentialCache.DefaultNetworkCredentials;
Console.WriteLine("Sending an email message to {0} by using the SMTP host {1}.",
to.Address, client.Host);
try {
client.Send(message);
}
catch (Exception ex) {
Console.WriteLine("Exception caught in CreateCopyMessage(): {0}",
ex.ToString() );
}
}
现在,您可以发送多个邮件,就像自动转发一样。