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

Free Support Forum - aspose.com

Create Draft Message using the Reporting Services Content(MHTML) and save as file?

Dear Aspose Support,

Could you Advise whether it is possible to use Aspose Component to

1. Create Draft (Unsent) Message as File (msg).

2. The Message Body is coming from Reporting Services 2008 R2 output MHTML.

After Microsoft VB.NET + C# component.

If possible could you tell me what apose components that I need to purchase to achieve the above requirement ?

My requirement is to create a draft emails and sent 1 single email that contain the draft email which the manager can review and send.

Mail to Manager for review.
Attachment: draft1.msg
Attachment: draft2.msg
Attachment: draft3.msg

Thanks in Advance.
Regards Dat.

Hello Dat,

Thank you for inquiry.

Aspose.Network for .NET can be used for the above listed requirements, provided that you already have the mhtml output in a file or stream.

Please visit [http://www.aspose.com/documentation/.net-components/aspose.network-for-.net/creatingsaving-outlook-message-msg-files.html ](http://www.aspose.com/documentation/.net-components/aspose.network-for-.net/creatingsaving-outlook-message-msg-files.html) (end of page) to create a message in draft mode. For sending emails, please visit [this page](http://www.aspose.com/documentation/.net-components/aspose.network-for-.net/sending-emails.html) and for adding attachments, [this page](http://www.aspose.com/documentation/.net-components/aspose.network-for-.net/managing-email-attachments.html).

I have also added the sample code below for your convenience.

// Load the mht document in message
MailMessage message = MailMessage.Load(“Aspose Newsletter July 2011.mht”, MessageFormat.Mht);
// Add some properties
message.From = "from@domain.com";
message.To = "to@domain.com";
message.Subject = “review this email”;
// convert to MapiMessage for saving as draft
MapiMessage mapiMsg = MapiMessage.FromMailMessage(message);
mapiMsg.SetMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT | MapiMessageFlags.MSGFLAG_FROMME);
mapiMsg.Save(“test.msg”);

You may download the component from [here](http://www.aspose.com/community/files/51/.net-components/aspose.network-for-.net/default.aspx). For evaluation, you may also get the temporary
license
that will work for 30 days in full functional mode.

Thank you, I am download the trial version now.

Thank you, I am downloading the trial version now.

Dear Support,

I was able to get your code working:

1. I have create report in reporting services 2008 r2 and export as .mhtml
2. Use your code to create draft email as file(msg)
3. create a new email attach the draft (in step 2) forward to my manager.
4. My Manager then open up the draft email and press send.
5. I have a problem when the message is received after step 4.
On iPad Email, when I open it up there are no Images on the page or (even image as an attachment).
On Android Honeycomb v3.1 Email, The Image does not appear in the content of the email but appeared as an attachment, therefore I see crosses on the screen.
 
Did I miss some setting in Aspose network component ?
 
If I get this to work my manager will be very happy.
Our staff have access to iPad/Android tablet.
and if I can get the image to show properly this would be brilliant.
That mean we can utilize Aspose Network Module to help us send formatted report to our internal staff.
I have attached 4 file: 
1. message.mhtml (export from reporting services 2008 r2)
2. message.msg (created from aspose network module)
3. draft email as at 14072011.msg is the message received by the manager.
then the message.msg get open and send.
receipt email/Final email received:
4. Sample Letter via Reporting Services (Input to the report is IRN).msg
 
Many Thanks.
Regards Dat.
            try
            {
                msg = MailMessage.Load(messagebody_filename, MessageFormat.Mht);
                msg.From = from;
                msg.To = to;
                if (cc != null && cc.Length > 0)
                {
                    msg.CC = cc;
                }
            <SPAN style="COLOR: blue">if</SPAN> (bcc != <SPAN style="COLOR: blue">null</SPAN> && bcc.Length > 0)
            {
                msg.Bcc = bcc;
            }

            <SPAN style="COLOR: blue">if</SPAN> (subject != <SPAN style="COLOR: blue">null</SPAN> && subject.Length > 0)
            {
                msg.Subject = subject;
            }

            <SPAN style="COLOR: #2b91af">MapiMessage</SPAN> mapiMsg = <SPAN style="COLOR: #2b91af">MapiMessage</SPAN>.FromMailMessage(msg);
            mapiMsg.SetMessageFlags(<SPAN style="COLOR: #2b91af">MapiMessageFlags</SPAN>.MSGFLAG_UNSENT | <SPAN style="COLOR: #2b91af">MapiMessageFlags</SPAN>.MSGFLAG_FROMME);
            mapiMsg.Save(output_filename);
        }
        <SPAN style="COLOR: blue">catch</SPAN> (<SPAN style="COLOR: #2b91af">Exception</SPAN> ex)
        {
            <SPAN style="COLOR: #2b91af">Console</SPAN>.WriteLine(ex.Message);
            <SPAN style="COLOR: #2b91af">Console</SPAN>.WriteLine(ex.StackTrace);
        }</PRE><PRE style="FONT-FAMILY: Lucida Sans Typewriter; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"> </PRE>

Hi Dat,

Does the image attachment problem occurs with Ipad and Android tablets only?
Do the images appear correctly in MS Outlook?

We have not yet tested how the messages are displayed on a tablet OS.

Could you please perform one more test at your end. Please create a draft message with MS Outlook, copy the contents of the mhtml file to the draft message, send this message, receive with the tablet OS and see if you receive the image attachment in correct form?

Dear Saqib,

Does the image attachment problem occurs with Ipad and Android tablets only?
Do the images appear correctly in MS Outlook?

Yes Image appear correctly in outlook 2003 and 2010

Could you please perform one more test at your end. Please create a draft message with MS Outlook, copy the contents of the mhtml file to the draft message, send this message, receive with the tablet OS and see if you receive the image attachment in correct form?

I've try your suggestion, open mhtml in internet explorer, I can see the image, but when it is copy into a new email in outlook the image does not copy.

Tried the following as well:

1. Change image format doesn't help from JPG to PNG

2. Open Windows Live and attach the mhtml file and sent it to myself.
Outlook was able to open the mhtml directly then I copy the contents and create a new message.
and send.

Apple Device was able to see the image not the tablet OS Stock Standard Email, but my other Mail Program (TouchDown on Tablet workfine in all cases).

But what I don't understand is other mail I receive from Advertisement the image appear correctly on any device. That is my goal, to have the message appear properly on any device.

3. I have try copy the content using above method 2 and create draft email then save as .msg, then compose a new message and send.

After receiving the email, I try to open up the attachment (it is in readonly, the send button is disable), can't send.

My Question would be what do I need to do to have the message appear correctly?

Regards Dat.

Dear Saqib,

I have saved 2 message:

Can see the message.msg - Image appear properly in iPad/iPhone Email

Cannot see the message.msg - Image does not appear in iPad/iPhone Email and no indication that there are image attachment.

Regards Dat.

Hi Dat,

Thank you for the feedback. We will check/compare these messages at our end.

Dear Saqib,



Any news ?



Regards Dat.

Hello Dat,

This requires some further investigation at our end, since we primarily tested with PC based mail clients. I will update you as soon as I get any news on this issue.

Dear Saqib,

Is there anything I can do to help to get this resolve?

Regards Dat.

Hello Dat,


We are looking into it and will ask you in case we require any feedback.