Skip to main content

Development

Create a Microsoft Outlook email using JavaScript

 

This proof of concept provides reusable code for implementing MS Outlook email functionality using JavaScript. Here we create a sample email content (.eml file) which could directly be hard coded or fetched from document id or class. Here we create a blob data type where we create mail subject using creatObjectURL () function. Here we append the content to anchor tag inner-html, on-click of which MS outlook email (.eml file) will be downloaded as a draft, along with receiver mail-id and subject. Below is the sample code which can be used for any application which requires creating MS Outlook email using JavaScript.

email1

email2

email3

 

Thoughts on “Create a Microsoft Outlook email using JavaScript”

  1. Hi Padma,
    Thanks for the detailed explanation of the code. I’ve tried to implement the same code and when I click the hyperlink, it’s prompting me to download the file instead of opening Outlook. Why is that? anything additional I need to add?

  2. Hi,
    Thanks for sharing the info, I tried it with IE10/11 and it doesn’t working getting access denied error @ document.getElementById(‘fileLink’).click()
    Can you please help me on this

  3. is their a java script which can open a mail stored in desk to as .msg format and convert the mail to HTML format and save the format as txt.

    or

    Convert .msg file to HTML file and save as notepad file

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Padma Deepika Narayanaswamy

More from this Author

Categories
Follow Us