使用Sysdate.Net.Mail發送Mail問題

crw_web02 2012-10-05 04:41:44
我的問題如何讓發送出去的MAIL,在接收到MAIL的人不可以再轉寄該封MAIL.

下面是正常發送MAIL的Function:
public void SendMailUseSMTP(string subject, string MailHost, string MailFrom, string MailFromPassWord, string MailTo, string MailCc, string text, string AttachmentsName, bool IsBodyHtml)
{
try
{
MailMessage msg = new MailMessage();
string[] To = MailTo.Split(';');
for (int i = 0; i < To.Length; i++)
{
msg.To.Add(To[i]);
}

string[] CC = MailCc.Split(';');
for (int j = 0; j < CC.Length; j++)
{
msg.CC.Add(CC[j]);
}
msg.From = new MailAddress(MailFrom, MailFrom, System.Text.Encoding.UTF8);
msg.Subject = subject;
msg.SubjectEncoding = System.Text.Encoding.UTF8;
msg.Body = text;
msg.BodyEncoding = System.Text.Encoding.UTF8;
msg.IsBodyHtml = IsBodyHtml;
msg.Priority = MailPriority.High;
if (AttachmentsName != "")
{
msg.Attachments.Add(new Attachment(AttachmentsName));
}

SmtpClient client = new SmtpClient();
client.Credentials = new System.Net.NetworkCredential(MailFrom, MailFromPassWord);
client.Host = MailHost;
object userState = msg;

client.SendAsync(msg, userState);
}
catch (System.Net.Mail.SmtpException ex)
{
throw new Exception("SendMailUseSMTP Subject:" + subject + " Exception:" + ex.Message);
}
}
...全文
152 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
只在此山中 2012-10-09
  • 打赏
  • 举报
回复
接收mail的帐号
crw_web02 2012-10-09
  • 打赏
  • 举报
回复
哦.知道了,謝謝!
crw_web02 2012-10-08
  • 打赏
  • 举报
回复
所以這麼說,應該要在MAIL服務器上去對這個發MAIL的帳號做權限設定?
只在此山中 2012-10-06
  • 打赏
  • 举报
回复
基本上没有这样通用的功能,特定邮件帐号和服务器可能可以设置禁止转发,但这个是服务器邮件用户的权限设置问题,和你的要求有出入.

110,939

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧