1

I'm currently developing an application that handles mail for mailboxes automatically. We use the tool Outlook Redemption and connect with one service account to multiple Exchange mailboxes.

Case

The problem we face is forwarding mail from the original mailbox. Say service account 'A' is handling shared mailbox 'B' and is forwarding mail. I'd like the sender to be the mail address of 'B', but when I receive the mail the mail address of 'A' shows up as sender.

Source code

// Initialize the session with the service account.
_session = new RDOSession();
_session.LogonExchangeMailbox(configurationSettings.MailAddress, configurationSettings.Url);

// Connect to the target mailbox and retrieve mail message.
RDOStore store = _session.Stores.GetSharedMailbox(targetMailBox);
RDOMail originalMailItem = store.GetMessageFromID(entryId);

// Creates a forwarded version of the mail.
RDOMail forwardMailItem = originalMailItem.Forward();

// Set sender to target mailbox owner.
if (store is RDOExchangeMailboxStore)
{
   forwardMailItem.Sender = ((RDOExchangeMailboxStore)store).Owner;
   forwardMailItem.SenderEmailAddress = targetMailBox;
}

// Set recipient and send.
forwardMailItem.Recipients.Clear();
forwardMailItem.Recipients.Add(forwardMailAddress);
forwardMailItem.Send();

Questions

  • Anyone got a clue on a solution?
  • If this won't work, is it possible to get the mail address of 'B' in the 'On behalf of' rule?

Thanks in advance!!

Herman Cordes
  • 4,628
  • 9
  • 51
  • 87

1 Answers1

1

The problem is that the message being forwarded is created in the primary store in the profile, not the delegate mailbox.

Besides setting the Sender property, have you tried to also set the SentOnBehalfOf property?

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • Thanks for your reply! I've tried setting that property, but in that case it seems the message is not sent at all... without any error. Is there any way the forwarded message can be created in the shared store? Thanks!! – Herman Cordes May 21 '13 at 07:07
  • 1
    You can save the RDOMail object returned by Forward(), then move it to the shared mailbox (RDOMail.Move - keep in mind Move() returns the new instance of RDOMail object that you must use). – Dmitry Streblechenko May 21 '13 at 16:26