Link to home
Start Free TrialLog in
Avatar of zachvaldez
zachvaldezFlag for United States of America

asked on

Sent email using Shared Mailbox from outlook in C#

I would like to send emails using the Shared Mailbox so that the 'From' property displays the Shared Mailbox name instead of my personal
email. How is that done. I use the Microsoft Office Interop.Outlook  library.
So far this is my code..

               // Create the Outlook application.
                Outlook.Application oApp = new Outlook.Application();

                // Get the NameSpace and Logon information.
                Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
                oNS.Logon(Missing.Value, Missing.Value, true, true);
----- somewhere here I'd like to switch it to the Shared Mailbox name 
               
                // Create a new mail item.
                Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);

                // Set the subject.
                oMsg.Subject = "Send Email in HTML ";

Open in new window

Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

I had similar issues a couple of months ago but I am not using the Outlook object.

You need to login to your regular mailbox and then set the From property to the shared mailbox email address.
Avatar of zachvaldez

ASKER

How do you set it to switch to the shared mailbox? And so what code can accomplish this? Thanks
in your oMsg object, don't you have a From property?
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
need exchange server to set settings sentonbehalf property fixed it!! Thanks