简体   繁体   中英

C# How to send mail from Outlook's Shared Mailbox and keep it in Sent folder there

I know how to send programmatically mails via shared mailbox in Outlook via Office.Interop. But still mail Ive sent is being stored in my personal sent items folder (instead of Shared Mailbox' Sent items). So other people cant see what was sent. Also it consumes my mailbox size quotas ...

Is there any way to send mails via Shared Mailbox and keep sent items there ? If not (so easy) than at least copy sent mail from my sent items folder top shared mailbox ?

* EDIT *

Below is my current code:

Application     app         = new Application();
MailItem        mailItem    = app.CreateItem(OlItemType.olMailItem);

mailItem.Subject        = subject;
mailItem.To             = to;           
mailItem.SentOnBehalfOfName = fromMail;


// Send
mailItem.Send();

You just need to set the MailItem.SaveSentMessageFolder property which sets a Folder object that represents the folder in which a copy of the email message will be saved after being sent.

Be aware, the folder should be presented in your store. If you need to move the sent items I'd recommend handling the ItemAdd event on the folder ( Sent Items by default) and move items programmatically by calling the Move method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM