Downloading Email body and attchments in .MSG format in Web Outlook - outlook

Is it possible to download email body and attachments in a file in .MSG format in Outlook Web? I am working on an Outlook 365 Web addin and I require to download entire message along with attachments in .MSG format?
Edit: Is there any open source library in .NET which does the same?
Thanks,

I have to do the same thing, but since the company I'm writting the addin for is using a version of Windows/MSOffice where the webview that the addin runs inside is handled by a IE11 process, I got OOM-error when trying to download an attachment bigger than 7MB via a EWS request (using the ews-javascript-api).
Now I'm using a IIS server to which I send the eschangeToken and EmailId and handle the download/upload of the email there via EWS-managed-api from MS.
Downloading the email as .MSG is not possible AFAIK, I download them by getting the MIME-content of the email and saving it as an .EML file.
Here MS provides some examples on how to use the ews-managed-api.

EWS cannot convert to MSG. You can try to save in the Fast Transfer Stream format using the ExportItems EWS operation (which, just like the MSG format, preserves most properties). The EML format, on the other hand, will not preserve MAPI specific properties. The FTS data can then be converted (without any loss of fidelity) to the MSG format using Redemption (I am its author - RDOSession.CreateMessageFromMsgFile / RDOMail.Import(..., olFTS) / RDOMail.Save), but since Redemption is a native COM library, that code would have to run on your server, not inside the browser.
RDOSession session = new RDOSession();
RDOMail msg = session.CreateMessageFromMsgFile(#"c:\temp\test.msg");
msg.Import(#"c:\temp\test.fts", rdoSaveAsType.olFTS);
msg.Save();

Related

Create an HTML file from body of an email using Cloud Flow Power Automate?

We receive order requests from some customers embedded in the email body rather than an attachment. In Outlook, I can manually save the message as HTML. I configured Power Automate to create a file from the email. I'm not sure what format it is but it isn't HTML as if I saved it directly from Outlook. I've already wrote SQL code to parse the HTML message. Redoing it in this different format is problematic because the source code doesn't align like the manually saved file.
It needs to run as a cloud flow so calling an Outlook macro from PA Desktop is not a solution.

How to get structured email headers from Outlook and process them in Power Automate Desktop

I am looking for a way to get structured email headers from Outlook and process them in Power Automate Desktop.
Assumptions
You can retrieve email headers in Outlook by using the following URL
https://support.microsoft.com/en-us/office/view-internet-message-headers-in-outlook-cd039382-dc6e-4264-ac74-c048563d212c
The Challenge
The mail headers obtained from the client application Outlook are in text format and very difficult to handle.
Constraints
We assume that we are parsing mail headers from an attached .msg file.
It is not possible to retrieve mail headers in json format using the Graph API.
Fortunately, Power Automate Desktop supports execution of VB script, JavaScript, Powershell, and DOS commands. It may be possible to take advantage of these to turn text into Json format, etc.
If you can use Outlook Object Model in VBS, you can retrieve MIME headers from a received message by reading the PR_TRANSPORT_MESSAGE_HEADERS MAPI property using MailItem.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x007D001F")

eml file with viewless body

I've a big problem because some eml file that are imported in the customer repository (IBM ECM) and retrieve from IBM Content Navigator.
This client demand the opening of this kind of file to the operating system and therefore to MS Outlook.
It occurs only for some of the emails and, by exporting the email and opening it with a test editor, it becomes clear that the problem is due to a series of null characters placed as the last line of the body of the email (I've attached a screenshoot).
Is there a way to allow Outlook to view these emails correctly?
Thinderbird for example also opens these emails without problems but the custome cant use this client, only MS Outlook is permitted.
Thank you in advance
email body

SMTP Excel corrupted attachment files

I've created a VB6 application from which I wish to send an SMTP email. The email is sent and received fine but when attaching an Excel 2003 file, whilst this is received okay, when trying to open it file becomes corrupt... I've also tried saving the attachment and then opening it but the problem persists. Thank you for any assistance...
The attachment data must be encoded. Not all mail servers and clients are 8-bit safe.
Base64 is the most common encoding method.

How to send email with an attachment using Windows Phone 7 API?

My WP7 application requirement is to send the email with an attachment and use device default SMTP settings.
I have tried EmailComposeTask class but it doesn't have any member for attachment.
The other idea, i am thinking is to upload the file on server and then send the email from that server.
What you think if there is no way to send the email with an attachment using WP7 API?
Your observation is correct, at this point in time EmailComposeTask doesn't support attachments and this is the only facility to send email programatically from the device at the moment.
As you note, you can communicate with a server which can perform this task on behalf of your app.
I found a wp7 and wp8 library that does it: http://www.windowsphonegeek.com/marketplace/components/livemailmessage
Try to create web service to send mail in your webserver. so, we can call the from your app to send mail.
I hope upcoming version it will be possible!
Please check this URL for more details http://forums.silverlight.net/forums/p/209808/493532.aspx
I've found this article, but I did not make any test yet.
From the author:
EmailComposeTask won’t allow you to send attachments, but this doesn’t mean that you cannot send files through it. .NET Framework has these two amazing methods: Convert.ToBase64String and Convert.FromBase64String. The first will allow the developer to convert a byte array (byte[]) to a Base64-encoded string, the other one will do the same operation in reverse.
Reference:
Pushing the Limits of the Windows Phone SDK and Sending Files via EmailComposeTask

Resources