We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Getting Oriented / Attaching Files to Email and Invoking Default Email App

In the Programmer’s Guide, it speaks of Email, Outlook, Exchange, Thunderbird, etc.

I am wanting to create a new email with an attached file and pre-filled subject and recipients. Then, I want to invoke the user’s default email app so that he/she can reviewand change anything as need and press “Send” from their default app.

I need to get a basic orientation. Am I supposed to code separately for each of Email, Outlook, etc.? Or is there one code-block for all of it.


Hi Jeff,

Thank you for writing to Aspose Support team.

You can use the [MailMessage API](http://www.aspose.com/docs/display/emailnet/Managing+Email+Message+Files+with+MailMessage) to create and save pre-filled messages for lateral view. You can create the message file, add attachments to it, fill the subject and message body details and then save to the following email formats that will open directly in default mail application.

  • MSG format

  • MSG Unicode format

  • EML format


MailMessage msg = new MailMessage("from@domain.com", "to@domain.com", “Test Subject”, “Test body”);

msg.Attachments.Add(new Attachment(“a.pdf”));
msg.Attachments.Add(new Attachment(“anotherPdf.pfd”));

msg.Save(“output.msg”, Aspose.Email.Mail.SaveOptions.DefaultMsg);
Hi Jeff,

Just for clarification.

You may save a message as an *.eml file:

msg.Save("output.eml", Aspose.Email.Mail.SaveOptions.DefaultEml);

It is an universal format and supported by many email apps.

Thank you, both. 2 more questions, please:


Must you save the email as a file to disk in order to send it to the default email app.?

Specifically, I want to do something similar to Process.Start() on it. I don’t care to save it unless I have to. I figure once I send it to the default email app, the app itself will save it if the user completes the transaction by sending the email.


Edit: It looks like msg.Headers.Add(“X-Unsent”, “1”) is the flag to mark as unsent so that Outlook will open the email in “Draft” mode. It works fine in Outlook. Can you confirm this is the same method for universal apps, such as gmail, hotmail, etc.? I just want to be sure it will work for all mainstream email apps.

Thanks again.


1. There is no other way than saving the message to disc first for opening the email.

2. Could you please your requirements about the opening of such emails with Gmail app, hotmail, etc.? As far as our knowledge is concerned, there is no such option of opening MSG or EML files with Gmail, hotmail or any other public service app. Please elaborate your requirements for further assistance.

The requirement is that I want to auto-generate an email form the app and send it to the user’s email app. I don’t want to deal with editing, sending, forwarding, etc. I want to simply send a barebones email message to the user’s default email app and let the default app handle all the heavy lifting.

This works for Outlook. Can this be done for the others, such as GMail, Yahoo, etc.?

If not, alternatively, if I have to write the additional code to get the email in final form and send it, how will I be able to make it appear as “Sent” items in whatever default email app the user has?


This may not work for other email apps than MS Outlook as the flag is specific to MS Outlook. When a message is sent using the Aspose.Email API, it automatically appears in the Sent items of these emails services and you don’t have to mark it explicitly as Sent.