Web Mail
I have an application that needs to be able to email reports either with the Windows Default email client (like Outlook) or with Web Mail, like GMail. I have the Web Mail working using the Indy based method from the Doc Wiki article here.
The problem is once I add the unit ppSMTPIndy10 to my uses clause to allow the Web Mail to work, I can no longer get the desktop email client to work when I click on the Email icon on the report. It will always error out with the exception "a host is required."
Once again, if I have the desktop email client version working when clicking the Email Icon on a report, this will cause an exception once I add the ppSMTPIndy10 unit to my uses clause, with out changing any other code or having any of the "EmailSettings" filled in for Web Mail clients. When using the desktop email client, the only EmailSettings I have checked are "Enabled" and "PreviewInEmailClient"
1) Is there a way I can have a desktop email client to work if this unit is added?
2) And if I have the Web Mail working by filling in the reports EmailSettings fields, the email will properly contain the report as an attachment when sent, but the Report Builder Email Dialog box doesn't actually show that there is an attachment. Do I need to do this in code by adding the created PDF file to the email's "attachments" list so it's visible on the RB Email dialog box?
I haven't tried the new "Rest" email units, as my clients use multiple web mail clients, other than just the 2 you provide, so the Indy solution is more flexible for my situation
Thanks for any help.
The problem is once I add the unit ppSMTPIndy10 to my uses clause to allow the Web Mail to work, I can no longer get the desktop email client to work when I click on the Email icon on the report. It will always error out with the exception "a host is required."
Once again, if I have the desktop email client version working when clicking the Email Icon on a report, this will cause an exception once I add the ppSMTPIndy10 unit to my uses clause, with out changing any other code or having any of the "EmailSettings" filled in for Web Mail clients. When using the desktop email client, the only EmailSettings I have checked are "Enabled" and "PreviewInEmailClient"
1) Is there a way I can have a desktop email client to work if this unit is added?
2) And if I have the Web Mail working by filling in the reports EmailSettings fields, the email will properly contain the report as an attachment when sent, but the Report Builder Email Dialog box doesn't actually show that there is an attachment. Do I need to do this in code by adding the created PDF file to the email's "attachments" list so it's visible on the RB Email dialog box?
I haven't tried the new "Rest" email units, as my clients use multiple web mail clients, other than just the 2 you provide, so the Indy solution is more flexible for my situation
Thanks for any help.
Comments
1. The mail feature uses a single plugin architecture so individual email plugins can be registered and unregistered with ReportBuilder and that plugin will then be used when the mail button is pressed. Alternatively, when the plugin unit is added to the uses clause, it is automatically registered as the active plugin (which is why the Indy plugin is being used when you add it to the uses clause).
ppSMTPMapi is the default registered plugin and is automatically registered.
You can control which plugin is being used by manually registering them in code using the TppSMTPPlugin.RegisterClass and UnRegisterClass routines. See demo 110 of the main reports demo for an example of this and take a look at the following article/example.
http://rbwiki.digital-metaphors.com/output/email/email-fundamentals/
2. The report itself is not added to the attachments list of the built-in email dialog because it has not been created yet. This could be a nice feature to have a placeholder for this file not that you mention it. I will add it to our list of possible enhancements.
Please let me know which web mail services such as Gmail or Outlook.com your users are using and I can research whether we can added support for these services in the future.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com