Exemplo n.º 1
0
        public static MessageBody GetMessageBody(EMAPILib.IEMessage message)
        {
            string messageClass = MessageType.GetMessageClass(message);

            if (MessageType.IsReportRead(messageClass))
            {
                return(new MessageBody(GenerateBodyForReportRead(message), MailBodyFormat.PlainText, 0));
            }
            if (MessageType.IsReportDelivered(messageClass))
            {
                return(new MessageBody(GenerateBodyForReportDelivered(message), MailBodyFormat.PlainText, 0));
            }
            return(message.GetRawBodyAsRTF());
        }
Exemplo n.º 2
0
            private MessageBody ReadBody()
            {
                if (_mail.HasProp(PROP.EmbeddedMessage))
                {
                    OutlookAttachment  attach  = new OutlookAttachment(_mail);
                    EMAPILib.IEMessage message = attach.OpenEmbeddedMessage();
                    if (message != null)
                    {
                        using ( message )
                        {
                            return(message.GetRawBodyAsRTF());
                        }
                    }
                    return(null);
                }
                if (_mail.Type == STR.EmailFile)
                {
                    IEMessage message = OutlookSession.OpenEmailFile(_mail);
                    if (message != null)
                    {
                        using ( message )
                        {
                            _subject = message.GetStringProp(MAPIConst.PR_SUBJECT);
                            return(message.GetRawBodyAsRTF());
                        }
                    }
                    return(null);
                }

                PairIDs IDs = PairIDs.Get(_mail);

                if (IDs != null)
                {
                    EMAPILib.IEMessage message = OutlookSession.OpenMessage(IDs.EntryId, IDs.StoreId);
                    if (message != null)
                    {
                        using ( message )
                        {
                            return(OutlookSession.GetMessageBody(message));
                        }
                    }
                    else
                    {
                        string bodyText = "Could not open message. It may have been moved or deleted in Outlook. Or message store for this mail cannot be open.";
                        return(new MessageBody(bodyText, MailBodyFormat.PlainText, 0));
                    }
                }
                return(null);
            }