Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

ppSMTPMapi problem

edited June 2010 in General
Hi,

I have an unusual problem that I'll try to describe:

We have a custom previewer, inheriting from ppPreview, which includes the
email button. When the user clicks the button it calls the 'SendMail'
routine in our own previewer which checks if the report uses email groups
(report.hasemailgroups) and, if it does, it registers the ppSMTPOutlook
plugin, sets a few parameters, and then calls 'print' which uses the plugin
to send multiple emails. That all works OK. If the report does not use email
groups then instead it registers the ppSMTPMapi class and calls the
inherited 'SendMail' routine to open a mailitem in outlook and allows the
users to enter the To, CC, BCC (etc) details and email body.

Here's the problem: if the user selects a report that does not have email
groups and then clicks 'email' it creates a new outlook mailitem just fine
and attaches a PDF of the report to it. However if the user first loads a
report that uses group emails (even if they just preview it) and then loads
a report that does not use email groups and tries to email it, it never
creates the outlook mail item or attaches the report. Some investigation
showed that it was actually generating the PDF but was giving it the wrong
name. Instead of 'report.pdf' we were getting 'report_6A.pdf', which looks
like an email group field code, only this report is NOT set up to use email
groups.

Tracing through the code, the problem seems to be something to do with the
TppPage.NewJob field. When TppPage.assign(source) is being called the
assigned value for the FNewJob field is being changed from the default
'False' to lPage.NewJob, which is set to 'True'. I cannot find where this
initial value is being set to 'True', though. It's as if it's being
remembered from the previous report.

Sorry for the long-winded explanation. Any ideas on the cause / solution?

Thanks,

Steve Branley
This discussion has been closed.