private static bool IsSignatureHtml(IWSAttachment attachment) { var id = attachment.GetFields(MAPIProxy.MapiDefines.PR_ATTACH_CONTENT_ID); var idw = attachment.GetFields(MAPIProxy.MapiDefines.PR_ATTACH_CONTENT_ID_W); string contentId = string.Empty; if (id != null) { contentId = id.ToString(); } string contentIdw = string.Empty; if (idw != null) { contentIdw = idw.ToString(); } if (!string.IsNullOrEmpty(contentId) || !string.IsNullOrEmpty(contentIdw)) { // Only allow file types we DON'T clean to be signatures. if (FileTypeBridge.GetSupportedFileType(attachment.FileName) == FileType.Unknown) { Interop.Logging.Logger.LogInfo(string.Format("Signature {0} on Html formatted message", attachment.FileName)); return true; } } return false; }
public static bool IsSignature(IWSAttachment attachment, MessageBodyFormat bodyFormat) { switch (bodyFormat) { case MessageBodyFormat.Html: return IsSignatureHtml(attachment); case MessageBodyFormat.Rtf: return IsSignatureRtf(attachment); } return false; }
public static bool IsSignature(IWSAttachment attachment, OlBodyFormat bodyFormat) { switch (bodyFormat) { case OlBodyFormat.olFormatHTML: return IsSignatureHtml(attachment); case OlBodyFormat.olFormatRichText: return IsSignatureRtf(attachment); } return false; }
private static bool IsSignatureRtf(IWSAttachment attachment) { var field = attachment.GetFields(MAPIProxy.MapiDefines.PR_ATTACH_METHOD); if ((field != null) && ((int)field == MAPIProxy.MapiDefines.ATTACH_OLE)) { try { // Only allow file types we DON'T clean to be signatures. if (FileTypeBridge.GetSupportedFileType(attachment.FileName) == FileType.Unknown) { Interop.Logging.Logger.LogInfo(string.Format("Signature {0} on Rtf formatted message", attachment.FileName)); return true; } } catch (Exception) { // When the mail format is rtf you are unable access the filename property of embedded images. return true; } } return false; }