News combit Dev Blog

Adding Signature Support to the Mail Module

Posted: Wednesday, August 7, 2019 | 0 comment(s)
 
This has been another great suggestion from our community at Idea Place. While the mail module is quite flexible and can send mails via SMTP, MAPI and XMAPI, and can either use the client's mail dialog or a custom, built in dialog, there was no way to append Outlook standard signatures to the sent mails so far. Microsoft has finally declined the request to add this feature to Outlook's MAPI implementation. So there was room for improvement.

Usage is absolutely straight forward, just set the option Export.Mail.SignatureName to either the name of an Outlook signature or a full path to a file including its file name but not the extension. We expect at least two files there, one with the extension *.htm and one with *.txt for each of the body formats. Depending on the body type(s) of your mail, we'll then add the associated signature to the very end of the mail. Sounds easy enough but still was a challenge (think mixing different HTML files to get a picture). To make it crystal clear – Outlook is not required for this feature to work. It should just work fine with any client.

The MailJob classes and the LsMailSendFile API also support this feature. A code sample for .NET (actually it's adapted from our existing C# Export Sample):

// create export configuration
ExportConfiguration exportConfiguration = new ExportConfiguration(_exporterTarget, fileNameTb.Text, "simple.lst");
exportConfiguration.ShowResult = _showFileCheck.Checked;

LL.ExportOptions.Clear();
LL.ExportOptions.Add(LlExportOption.ExportSendAsMail, "1");
LL.ExportOptions.Add(LlExportOption.ExportMailTo, "combit GmbH <SMTP:llmailtest@combit.net>");
LL.ExportOptions.Add(LlExportOption.ExportMailSubject, "combit List & Label mail test");
LL.ExportOptions.Add(LlExportOption.ExportMailShowDialog, "1");
LL.ExportOptions.Add(LlExportOption.ExportMailSendResultAs, "text/html");
LL.ExportOptions.Add(LlExportOption.ExportMailProvider, "XMAPI");
LL.ExportOptions.Add(LlExportOption.ExportMailBody, "Test");
LL.ExportOptions.Add(LlExportOption.ExportMailHtmlBody, "<html><head></head><body>Test</body></html>");
LL.ExportOptions.Add(LlExportOption.ExportMailSignatureName, "standard");


// Start export
LL.Export(exportConfiguration);

In this case, the signature is just referenced by its name. Thus, it's loaded from the Outlook signature directory (typically %userprofile%\AppData\Roaming\Microsoft\Signatures). And running this code of course results in the following (excuse my German Outlook) - my standard signature appended to the hand crafted mail.

Thanks for this feature request – delivered. Have you made any experiences with our forum and idea place? If not, why not come over and join the community? If yes, it would be great to read about it in the comments.




Author: Jochen Bartlau
Head of Development List & Label

Jochen Bartlau leads the development at combit as Managing Director. He's a Microsoft .NET enthusiast driving innovation & agile project management. The mobile devices geek who used to be a physicist in his first life loves to spend his spare time with his family.


  

+1 800 256 3608 (toll-free North America only)