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

Free Support Forum - aspose.com

Convet multiple word to one email

Hi,

I am try to convert multiple word to one email, but there’s some extra text generated after first document, see below.

MIME-Version: 1.0 Content-Disposition: inline; filename=ocument.html" Content-Type: text/html; charset=tf-8" Content-Transfer-Encoding: quoted-printable Content-Location: document.html

Please advise how to remove this. This is how I do it.

tempDoc.Save(tempStream, tempOptions); //tempStream = second doc
tempStream.Position = 0;
tempStream.CopyToAsync(stream);//stream = first doc with position set to stream.length

Thanks.
Constance

@ConstanceLi,

Thanks for contacting support.

Can you please share some details regarding the API which you are using and if possible, please share the complete code snippet, which can help us in replicating the issue in our environment. We will test the scenario and will share our findings. We are sorry for this inconvenience.

@codewarior

Please see below.

string[] files = {“file1”,“file2”};
Aspose.Words.Saving.HtmlSaveOptions options = new Aspose.Words.Saving.HtmlSaveOptions();
options.SaveFormat = SaveFormat.Mhtml;
options.ExportHeadersFootersMode = ExportHeadersFootersMode.None;

//Loop though all the docs and keep appending
MemoryStream stream = new MemoryStream();

for (int i = 0; i < files.Length; i++)
{
//set first file position to file length
Document doc = new Document(files[i]);
MemoryStream tempStream = new MemoryStream();
doc.Save(tempStream, options);

if (i == 0)
{
doc.Save(stream, options);
tempStream.Position = tempStream.Length;
stream.Position = tempStream.Length;
}
else
{
tempStream.Position = 0;
tempStream.CopyTo(stream);
}
//SendEmail(“Test”, tempStream, null, null, null);
}
SendEmail(Subject, stream, ToEmails, CCEmails, BCCEmails);

@ConstanceLi

Thanks for your inquiry. Please note it is expected behavior that Aspose.Words for .NET adds metadata in MHTL file. Aspose.Words mimics MS Word behavior. If you convert a document to MHTML using MS Word, it will also add metadata to MHTML. The metadata is used by other applications to display/parse contents. We will appreciate it if you please share some details why you want to delete this information?

@tilal.ahmad

Please see my sample email below, which will look very strange if cannot remove the meta data.

{

We trust the above is in order xxxxxxxxxxxxxx. //end of doc 1

MIME-Version: 1.0 Content-Disposition: inline; filename=ocument.html" Content-Type: text/html; charset=tf-8" Content-Transfer-Encoding: quoted-printable Content-Location: document.html

This is an automated email sent by our system. Please kindly reply to confirm receipt. //doc 2
some other content

}

@ConstanceLi

Thanks for your feedback. Please share following resources here as ZIP file, we will test the issue at our end and will guide you accordingly.

  • Your input Word documents
  • Output email, that shows undesired behavior
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.