Move mail to another mailbox

I am working on an application where I need to transfer mail from mailbox to anoter one. I cannot send these emails using smtp because it will change the header information. I am using C # and the out look api to process emails. it is any way to transfer mail to another mailbox without changing the mail header.


By translation I mean, I need to take mail from one mailbox and move it to another mailbox without changing the header information. If I use smtp, the header information is changed. I've heard that MAPI mail usage can be migrated from one mailbox to another mailbox. any pointers.

+1


source to share


6 answers


If you cannot load all the relevant mailboxes into one Outlook profile, this cannot be resolved using the Outlook API. However, it might be possible to run a stand-alone application from an administrator account that accesses the Exchange Information Store directly through extended MAPI. You can then open the source mailboxes sequentially and move the corresponding mail items to the target mailbox.

This will allow you to run a batch job that collects all mailboxes from a central location in one giant operation. If, however, your job is to move messages as they appear, then perhaps addressing this in a more decentralized way using Outlook add-ons installed on the original machines might make more sense. Perhaps if you could tell us a little more about your motivation for moving these items, we can offer an even better solution.



If you go for a centralized harvester approach, I highly recommend using a helper library like Redemption , although otherwise it will probably be a couple of months before you gather enough knowledge to tackle the task. The RDO (Data Redemption Objects) structure should be particularly well suited to run ASAP.

+1


source


I was able to move mail from one mailbox to another using Redemption. It is like a copy of a letter from one mailbox to another. First entry into the recipient's mailbox using ransom. Get a link to the folder you want to move the mail to. In my case, it was a mailbox. now convert Outlook mail item to RDOMail and copy rdomail folder to destination folder. there is code here -

 rdoSession.LogonExchangeMailbox("TEST", "ServerName");
 RDOExchangeMailboxStore mailBoxStore = (Redemption.RDOExchangeMailboxStore)
 rdoSession.Stores.DefaultStore;
 RDOFolder inboxFolder = null;

            foreach (RDOFolder rdoFolder in mailBoxStore.IPMRootFolder.Folders)
            {
                if (rdoFolder.Name.Equals("Inbox", StringComparison.InvariantCultureIgnoreCase))
                {
                    inboxFolder = rdoFolder;
                    break;
                }
            }
            rdoMail.CopyTo(inboxFolder);

      



with this, the mail will be copied to the new mailbox without changing the header information.

+2


source


If you're using the Outloook API, I'm sure there is backup and restore support. Therefore, back up your emails from one account and restore it from another. This would be my first try. PS: I am not familiar with the API.

0


source


What is the mailbox relationship? Are they on the same Exchange server? If so, your best bet is to use MAPI to copy messages. If not, you can export messages to PST or a collection of .msg files. Do I need to automate this?

0


source


What exactly do you mean by "transfer"? If you're talking about the equivalent of dragging and dropping mail from one mailbox to another loaded into the same Outlook profile, just use the method MailItem.Move

.

0


source


Then you need MAPI. This is a rather complex API. There's one long printed book about it, but that's it. The best place to start is to download MFCMapi and see how you can do what you need to do, like open two users' mailboxes and copy a message between them. Then look at the MFCMapi source and see how it's done and work from there.

0


source







All Articles