开发者

Using Redemption to reply to a mail only intermittently sets the body text

I'm using the below method to reply to mails coming in to a business function mailbox.

The body text being added is only intermittently being set. This method is only called when someone has emailed in to unsubscribe from a mailing but the email address of the sender (or in the body) hasn't been found in the database and we want to ask them to send us the mail address they want to unsubscribe.

private void replyToMail(OutlookItem item)
        {
            RDOSession session = new RDOSession();
            session.Logon(null, null, null, true, null, null);
            RDOMail thisItem = s开发者_高级运维ession.GetMessageFromID(item.EntryID, item.StoreID, null);
            RDOMail reply = thisItem.Reply();

            RDOAddressEntry optingout = session.AddressBook.GAL.ResolveName("optingout");
            //reply.Sender = optingout; this had no effect
            reply.SentOnBehalfOf = optingout;
            reply.Subject = "Automated Response - Could not complete unsubscribe";
            reply.Body = "This is an automated response from the Newsletter unsubscribe system. We couldn't find "+item.Sender+" in our database to unsubscribe you from our mailings.\r\n\r\nPlease reply to this mail and include the email address you want to unsubscribe.\r\n\r\nKind Regards\r\n.";
            reply.Send();

            session.Logoff();
        }


Firstly, if you are already usign OOM, there is no reason to call RDOSession.Logon. You can simply ste the MAPIOBJECT property: Replace the line session.Logon() with session.MAPIOBJECT = item.Application.Session.MAPIOBJECT do not call Logoff.

Secondly, do yo umean the message is received with out a body? Do you see teh empty bofy in the Sent Items folder?


I had to edit thingie.HTMLBody as well as thingie.Body.

I suppose I could have figured out how to tell when to set the value of each one but since I just want to be sure that I have control of the body in this instance I'm simply setting both.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜