Free Support Forum -

Adding signature to generated mail message


We are using the TemplateEngine to generate a mail message from a mail template. Current code (excerpt below) only does text substitutions.
We want to be able to also add a signature to the generated email.

You have a sample ( which appears to add a signature by registering a method in the line:
engine.RegisterRoutine(“GetSignature”, GetSignature);

Are we able to insert an image (rather than text) using this method? If so please provide some sample code.
What other ‘things’ can we use the RegisterRotine() method for?

Also are we able to insert images via the engine.Merge() method?

Thanks for your assistance.

Excerpt from our code

/// creates a new message by applying mail merge operation to message_
/// - if no merge data, returns a clone of message_

private MailMessage ExpandMacros(MailMessage message_, Pair<string, string>[] macro_list_, string salutation_)
var fixed_cc_for_merge = false;
if (message_.CC.Count == 0)
message_.CC = message_.From;
fixed_cc_for_merge = true;
MailMessage result = null;
if (message_ != null && message_.AlternateViews.Count != 0)
var data = GetMacroSubRow(macro_list_, salutation_);
if (data.ItemArray.Length != 0)
var engine = new TemplateEngine(message_);
result = engine.Merge(data);
if (fixed_cc_for_merge && result != null)
return result ?? message_.Clone();



I have observed your requirements and like to share that we need to investigate further about adding image as signature in mail message. An issue with ID EMAILNET-39279 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.


@mudassir.fayyaz, thanks for that. Hopefully it will lead to a useful update.

As an alternative to using the template engine, I found some sample code from the Aspose web site which adds images to a html body through LinkedResource objects. (

The code wraps an image in a LinkedResource as per the extract below.

LinkedResource barcode = new LinkedResource(dataDir + “1.jpg”, MediaTypeNames.Image.Jpeg)
ContentId = “barcode”

However in our Aspose version (DotNet, 19.1) the LinkedResource class does not have a ContentId property.
Do you have example of embedding images in a mail message in v19.1?



We need to investigate the requirement further on our end and will get back to you with feedback on this as soon as possible.



I have verified the part of above sample code on concerned example code. There has been no issue with LinkedResource class. I suggest you to please visit this Github example link for complete example. You can download the working example Aspose.Email project to verify the working of examples as well.


thanks. I was just missing a using directive.



Its good to know things are fine on your end.