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

Free Support Forum - aspose.com

Sending Email with Mhtml using Aspose.Network leads to mail without body and with attachments

I've a
1. word document read with Aspose
2. created a Mhtml stream
3. Send this stream using aspose.network

The e-mail is received without a body. The html and all images are available as attachment.
I expected to see the html as the body of the e-mail. I didn't expect to see any attachments.

Can you tell we how to solve this issue.

This is the code i used to send the e-mail:
// Save into a memory stream in MHTML format.
Stream stream = new MemoryStream();
doc.Save(stream, SaveFormat.Mhtml);

// Rewind the stream to the beginning so Aspose.Network can read.
stream.Position = 0;

// Create an Aspose.Network MIME email message from the stream.
Aspose.Network.Mail.MailMessage asposeMessage =
Aspose.Network.Mail.MailMessage.Load(stream);

asposeMessage.From = "email@from";
asposeMessage.To = "email@to";
asposeMessage.Subject =
string.Format("Aspose.Words + Aspose.Network: SEND MHTML Message");

//Send email via Apose Network
Aspose.Network.Mail.SmtpClient client = new Aspose.Network.Mail.SmtpClient();
client.Host = "my_smpt_server";
client.AuthenticationMethod = Aspose.Network.Mail.SmtpAuthentication.None;
client.Send(asposeMessage);

Hi,

Thanks for your inquiry.

I was able to reproduce this bug by using similar code as yours. I have also added it in our bug tracking system (ID: 11946). We will look into it and get back to you as soon as it is fixed. Sorry for the inconvenience.

Hi,

I would like to implement the same functionality as described in the post. Can you please keep me updated as well?

Thanks,
Ron van Leeuwen

Hi Ron,

Please subscribe to this thread, you will get a notification/update when this functionality is available.

Hi Saqib,

We are facing the same problem with Aspose.Network (version 5.1.0.0). Posted email displayed empty body with html attachment. Could you please provide the solution.

Regards,

Sachin Nagane

Hi Sachin,


I did some tests with Aspose.Network for .NET v5.1 and opened the email in different clients.

Microsoft Outlook 2007 shows the html and image attachments, which is a problem.
Gmail and Hotmail web clients display the email fine (body includes text and image attachment).

We will look into it and get back to you soon.

The issues you have found earlier (filed as 11946) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Currently I’m evaluating the latest version of Aspose.Network (5.6.0.0) and I’m still getting the messages with an empty body and the message included as “document.html” attachment. I’ve even tried the 5.5.0.0 version - same results.

While debugging I see that the message is properly formated, HTML body is correctly set but while the message is being sent then something is going wrong I guess. Could you look at this issue please as we really need this functionality?


Regards,
Samir

Hi Samir,


Thank you for inquiry.

I just tested the sample code from http://www.aspose.com/documentation/.net-components/aspose.network-for-.net/use-ms-word-document-as-body-of-message-and-send-email.html with v5.6 of Aspose.Network for .NET, but I could not find any problem.

Could you please use the same code mentioned in the above link and try again? If still you find any issue, please post the screenshot, sample code, document etc, so that we could also reproduce the issue at our end to find the problem.

I've attached a demo project where you can reproduce this issue. You would need to change the email addresses and the smtp host as well.

Aspose.Words I've used here is version 6.6 but the latest version does not change anything here.


Regards,
Samir


P.S. I guess you will need to update your documentation. Over here: http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/howto-convert-a-document-to-mhtml-and-email.html the following Load() function is used:

MailMessage message = MailMessage.Load(stream);

but in the sample you've been referring to:

MailMessage message = MailMessage.Load(stream, MessageFormat.Mht)

This makes a huge difference as the message is delivered properly now. Thank you.

Hi Samir,


We will update the article soon. Sorry for the inconvenience caused.