# Embedding mhtml file into email message



## liliarum (Jul 30, 2004)

Could anybody help me. 
(I am working on .NET)
My problem is: I create MailMessage, attach MHTML file and send it using SmtpMail. If I send file of any othe format then mhtml the receiver gets the message with the attached file (ex. MyFile.pdb), but when I send a message with MHTML attachment, the receiver gets the message with the attachement called "Untitled Attachment". When I click on it a new message window opens up with the attached MHTML file embedded in it.
I need either the MHTML file was specified as a file (MyFile.mhtml) or to be embedded into the message when the receiver opens it. How can I do this?

Thank you in advance.


Here is my code:

MailMessage mail = new MailMessage();

mail.From = strSenderEmailAddress;
mail.To = strAddresseeEmailAddress;
mail.Subject = "...";
mail.BodyFormat = MailFormat.Html;

MailAttachment attachment = new MailAttachment( "C:\\Program Files\\Level Platforms\\Service Center\\BasicReports\\LPI 612Demosys_BasicReport.mhtml" );

mail.Attachments.Add( attachment );

SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(mail);


----------



## Rockn (Jul 29, 2001)

What is an mhtml file? The end user receiving the file probably has no file associations set up to open this file. Many mail servers and mail clients also block HTML formatted messages. What mail client are they using?


----------



## liliarum (Jul 30, 2004)

MHTML file format is a standard format for aggregation html and all resources it refers.
The mail client is Outlook, but I think it's not an issue: if I attach mhtml file manually in Outlook it is delivered normally.


----------

