我正在使用 MailAddress 创建传真电子邮件。我们正在使用名为 SatisFAXtion v 8.6 的系统。要为传真提供封面,我可以将模板位置添加到 mail.TO 地址。
格式如下所示:
12125551234^template=cp\\FAXReportCover.rtf@fax.ourcompanymail.com
编译时它工作正常,但我需要两个反斜杠,所以我添加了两个作为转义字符。
当我运行程序时,我得到一个异常:
Message: An invalid character was found in the mail header:
StackTrace: at System.Net.Mail.MailAddressParser.ParseLocalPart(String data, Int32& index, Boolean expectAngleBracket, Boolean expectMultipleAddresses)
at System.Net.Mail.MailAddressParser.ParseAddress(String data, Boolean expectMultipleAddresses, Int32& index)
at System.Net.Mail.MailAddressParser.ParseMultipleAddresses(String data)
at System.Net.Mail.MailAddressCollection.ParseValue(String addresses)
at System.Net.Mail.MailAddressCollection.Add(String addresses)
at System.Net.Mail.Message..ctor(String from, String to)
at System.Net.Mail.MailMessage..ctor(String from, String to)
有没有办法在 MailAddress 对象的电子邮件地址中插入反斜杠?