Using a custom export method with standard List&Label mail handling

For performance reasons, we redirect the generation of CSV and XLS files to a different program. So List&Label is not generating the output. However, we would still like to use the List&Label mail capabilities.
But that does not seem to work if we run the export without user interaction.

DebWin4 shows that LlPrntEnd() calls a function getFilenames() which returns “0 elements”. This is of course expected, as we use our own logic to create e.g. the XLS file.

My question is: Is there a way to “trick” List&Label into believing that the file generated by our custom program is in fact the file that should be send by email?

You may want look at the MailJob class (when using .NET) or the LsMailSendFile API when using the API - both approaches allow to send emails directly.

Also, you may set the Export.Mail.AttachmentList export option via LL.ExportOptions.Add or LlXSetParameter (see chapter 7.5.2 in the programmer’s reference) to add files to the email created by the export process.

I understand that the output is ultimately generated when LlPrintEnd() is run.

I was just wondering: If I create a ‘small’ XLS file with only 1 row, then LlPrintEnd() will pick that up and use the standard mail settings to send the file. I can add my custom generated XLS file as attachment, that works.

Just wondering if there is a “hook” to replace the file (contents) generated by LlPrintEnd() by mine, just before ListLabel tries to send it by mail.

I’d really not print at all if you have the result already at your hands :slight_smile: - then printing is a huge performance overhead. To answer the question - no, there is no replacement hook/event.

Thanks, it was indeed easy to just use the email functionality ( LsMailSendFile) API to send the generated output. Just used the mail options already configured for the export target as input values.

One strange thing though (took me some time to figure this out): IExport options were set using LlXSetParameter and retrieved using LlXGetParameter. For the mail parameters, there is an inconsistency:

LlXSetParameter("Export.Mail.To") works, but LlXGetParameter("Export.Mail.To") does not. For some reason, it needs to be LlXGetParameter ("Export.Mail.TO") (not the word TO in uppercase).

Thanks for the heads-up, we’ll figure that out. Good to hear you’re up and running now.

LlXSetParameter("Export.Mail.To") works, but LlXGetParameter("Export.Mail.To") does not. For some reason, it needs to be LlXGetParameter ("Export.Mail.TO") (not the word TO in uppercase).

Via the support portal, we have sent you updated modules on the described behavior.
Please let us know your test results.