views:

66

answers:

2

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 = session.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();
        }
A: 

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?

Not sure what OOM is... the OutlookItem type passed in is a custom class used in the software...Apologies on the lack of clarity. The mail received has a body as you would expect if you hit reply and then send without typing anything.In other words it appears that my Call to Reply.Body = "..."; is having no effect.
Paul D'Ambra
A: 

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.

Paul D'Ambra