我通过使用获得了电子邮件对象和附件
Mail.attachments.count,但存档的电子邮件无法正常工作,因为它正在使用 Enterprise Vault。
我收到附件,但存档电子邮件无法正常工作并给出 0 或 1 计数
我浏览了电子邮件正文,发现当电子邮件存档时,附件会以如下两种方式显示。
第一
<<Attachments data>>
第二次
Attachments:
Attachments data
为了获取附件,可以使用以下逻辑:
iStartIndex = strEmailBody.LastIndexOf("<<") + 2;
iLastIndex = strEmailBody.LastIndexOf(">>") - 2;
string strAttachmentsData = strEmailBody.Substring(iStartIndex, iLastIndex - iStartIndex);
var regexObj = new Regex(@".*\)");
var allMatchResults = regexObj.Matches(strAttachmentsData);
}
else if(strEmailBody != null && strEmailBody.LastIndexOf("Attachments:")!=-1)
{
iStartIndex = strEmailBody.LastIndexOf("Attachments:") + 12;
string strAttachmentsData = strEmailBody.Substring(iStartIndex, strEmailBody.Length - iStartIndex-1);
MatchCollection allMatchResults = null;
var regexObj = new Regex(@".*\)");
allMatchResults = regexObj.Matches(strAttachmentsData);
}