Free Support Forum - aspose.com

Sending an MHTML messages sends an empty email

Hi,

I'm trying to create and send a message from an MHTML file. I receive an empty message only. Can you please let me know what is wrong.

Attached is my MHT file.

My code is this:

MimeMessage message = MimeMessage.Load(mhtFileName);
message.From = ;
message.To = ;
message.Subject = "mhtml test";

SmtpClient client = new SmtpClient();
client.Host = ;
client.AuthenticationMethod = SmtpAuthentication.None;
client.Send(message);

I'm using an Aspose.Total license.

I've got some progress, but not yet completely there.

When using MailMessage class and LoadContent instead of MimeMessage I actually got the message through. It comes with correct HTML body, but the images appear as attachments in MS Outlook and the email window fails to display/find them. They are displayed as red crosses.

I still need help on this issue please!

Hello,

I have tested with following code. it is ok. Please check it out.

MailMessage msg = MailMessage.Load(@"c:\testout.mht");
msg.From = from@domain.com;
msg.To = "to@domain.com";
SmtpClient client = new SmtpClient("smtp.server.com", "user","password");
client.Send(msg);


Thanks,

Hello, Romank,

How's your problem. I have checked the MailMessage.Load and MailMessage.LoadContent. All of them can produce proper output. The email can show images without problem.

Please check the attachment -- the snapshot. Let me know if you need any help.

Thanks

I managed to get it working thanks.

Among few other things it did not like mime part urls such as file://image.001.png. In this case the images appeared as attachments in Outlook, not as images in the message. I changed them to "image.001.png" and that worked better.