cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Owizardo
Level: Powered On

Exporting HTML content to MSG or EML

Hello,


I have a basic application with a form that i then organise in a HTMLText box later on. I have a button that will then send the HTML contents via email using the Office365.SendEmail(). All this works just fine, however I would like to have a contengency option in the case where Office365.SendEmail() fails me, I need to be able to export the HTML content to a MSG or an EML file.

This would allow my users to have a second fail safe to manually generate the email instead of fully relying on powerapps' Office365 functions.

In javascript I would be able to do something like:

var emlContent = "data:message/rfc822 eml;charset=utf-8,";
emlContent += 'To: '+emailTo+'\n';
emlContent += 'Subject: '+emailSubject+'\n';
emlContent += 'X-Unsent: 1'+'\n';
emlContent += 'Content-Type: text/html'+'\n';
emlContent += ''+'\n';
emlContent += htmlDocument;

var encodedUri = encodeURI(emlContent); //encode spaces etc like a url
var a = document.createElement('a'); //make a link in document
var linkText = document.createTextNode("fileLink");
a.appendChild(linkText);
a.href = encodedUri;
a.id = 'fileLink';
a.download = 'filename.eml';
a.style = "display:none;"; //hidden link
document.body.appendChild(a);
document.getElementById('fileLink').click(); //click the link

Is there anyway to achive this?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support Team
Community Support Team

Re: Exporting HTML content to MSG or EML

Hi @Owizardo,

 

As far as I know, there is no way to export the content when the Office365.SendEmail() action fails.

 

But if you would like to export an Email already sent, then you may take use of the Export Email action through Microsoft Flow:

Checking the following Microsoft Flow for more details about how to work with the Export Email action:

Improvements to the Outlook connectors and more

 

Best regards,

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Highlighted
Community Support Team
Community Support Team

Re: Exporting HTML content to MSG or EML

Hi @Owizardo,

 

As far as I know, there is no way to export the content when the Office365.SendEmail() action fails.

 

But if you would like to export an Email already sent, then you may take use of the Export Email action through Microsoft Flow:

Checking the following Microsoft Flow for more details about how to work with the Export Email action:

Improvements to the Outlook connectors and more

 

Best regards,

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,991)