Search code examples
outlookoffice-jsoutlook-addinoffice-addinsoutlook-web-addins

How to send an email from an outlook office add on?


I am trying to build an outlook add on, using react. I looked everywhere trying to find something that uses the mailbox in which the addon has been opened from, to programmatically send an email to a specified user.

Something similar to the google's command:

  GmailApp.createDraft(e.parameters.address, e.parameters.subject, e.parameters.body, {
    htmlBody: e.parameters.body,
    name: 'Automatic Sender'
  }).send();

Is the mail-sending process available on outlook?


Solution

  • Outlook web add-ins work under the context of currently selected item only. OfficeJS doesn't provide anything for creating and sending emails programmatically.

    In Outlook add-ins you may consider using EWS, see Call web services from an Outlook add-in for more information. Also you may take a look at the Graph API as a possible workaround.