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

Free Support Forum - aspose.com

Extra spaces in hyperlink when generating mail from a document template


I have an issue where all links in a document template, gets an extra space appended when generating the mail message. For example :

(www.foo.com) becomes (www.foo.com ).

I am using Aspose.Email version

Also if the a Word document is created based on the same template, the problem doesn’t occur.

I hope someone here can help me.

Christoffer Werge

Hi Christoffer,

Thank you for contacting Aspose support team.

I have tried the scenario using following code and observed that no extra space is added in the resultant MSG file. Give a try to the sample code using the attached .doc file and share the feedback. Please ensure that you use latest library Aspose.Email for .NET 17.2.0 in your testing. If issue is not resolved, share your sample code and .doc file for our testing here.

string dataDir = @"";<o:p></o:p>

// Load a Word document from disk and save to stream as MHTML

Aspose.Words.Document wordDocument = new Aspose.Words.Document(dataDir + "Test.doc");

MemoryStream mhtmlStream = new MemoryStream();

wordDocument.Save(mhtmlStream, Aspose.Words.SaveFormat.Mhtml);

// Load the MHTML in MailMessage

mhtmlStream.Position = 0;

MailMessage message = MailMessage.Load(mhtmlStream, new MhtmlLoadOptions());

message.Subject = "Sending Invoice in Email";

message.From = "sender@gmail.com";

message.To = "recipient@gmail.com";

// Save the message in MSG format to disk

message.Save(dataDir + "WordDocAsEmailBody_out.msg", Aspose.Email.Mail.SaveOptions.DefaultMsgUnicode);

Hello Kashif

Thanks for the help, it seems the issue is not with Aspose. Utilizing your snippet of code in a small console application, links looked like they should, however implementing it in our solution did not help. It did however clarify that it is later parts of the application that introduces the error.

Best regards
Christoffer Werge

Hi Christoffer,

Thank you for the feedback. Please feel free to write us back if you have any other query in this regard.