none
Sending Mail from Drafts Folder - Multiple users RRS feed

  • Question

  • We have a windows desktop application that creates email and adds it to the Drafts folder of a second email account on a users Outlook 2016 (Office 365).

    User A and user B both have their own mailbox and a second accounts mailbox added to Outlook to which they have SendAs / SendOnBehalf of permissions.

    User A runs the application which creates the email, adds an attachment and saves the email in the drafts folder of the accounts mailbox. User A can open the drafts folders and click on the mail and send it no problem.

    If user B goes to the drafts folder of the accounts mailbox and selects one of the draft emails and clicks send they get a NDR saying "The recipient has been deleted or has no e-mail address" 

    If user B opens the draft email and deletes the email address and retypes it and hits send it goes?

    This what we are doing:-

    Outlook.Application application = this.OutlookApp;
        Outlook.NameSpace nameSpace = application.GetNamespace(Type: "MAPI");
        Outlook.MAPIFolder draftsFolder = nameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDrafts);
       
         Outlook.Recipient omUser = nameSpace.CreateRecipient(emailSendFrom);
         omUser.Resolve();

         draftsFolder = nameSpace.GetSharedDefaultFolder(omUser, Outlook.OlDefaultFolders.olFolderDrafts);

        String fileName = CreatTempFile(attachement, invoiceNumber);

        var mailItem = (Outlook.MailItem) draftsFolder.Items.Add();

        mailItem.SentOnBehalfOfName = emailSendFrom;
        mailItem.To = emailTo;
        mailItem.Subject = emailSubject;
        mailItem.HTMLBody = emailBody;
        mailItem.Attachments.Add(fileName, Outlook.OlAttachmentType.olByValue, Type.Missing, Type.Missing);
        mailItem.Save();

        File.Delete(fileName);

    Any assistance much appreciated.

    Geoff

    Thursday, October 18, 2018 4:47 PM

All replies