sending report as PDF attachment with Indy
I want to e-mail a report as PDF attachment, without user intervention.
First, I tried sending with MAPI (Outlook). This works, but has a few
disadvantages (security dialog, mails are kept in sent items,...)
Now I want to try with SMTP Indy.
(see 'Send Email directly using Indy' in manual)
But nothing happens, no mail is received.
This is my small program :
uses ppSMTPCustom, ppSMTPIndy10;
...
with ppreport1 do begin
allowPrintToFile := true;
showPrintDialog := false;
PDFSettings.author := 'author';
PDFSettings.title := 'title';
PDFSettings.openPDFFile := false;
EmailSettings.enabled := true;
EmailSettings.subject := 'emailsubject';
EmailSettings.filename := 'document.pdf';
EmailSettings.recipients.add('xxx@yyy.zz'); // my valid email address
EmailSettings.reportformat := 'pdf';
EmailSettings.previewInEmailClient := false;
EmailSettings.showEmailDialog := false;
EmailSettings.hostaddress := 'my host'; // valid host address
tppSMTPPlugin.registerClass(tppSMTPIndy);
SendMail;
end;
Any idea ?
Rbuilder 11.08 Delphi 2009
First, I tried sending with MAPI (Outlook). This works, but has a few
disadvantages (security dialog, mails are kept in sent items,...)
Now I want to try with SMTP Indy.
(see 'Send Email directly using Indy' in manual)
But nothing happens, no mail is received.
This is my small program :
uses ppSMTPCustom, ppSMTPIndy10;
...
with ppreport1 do begin
allowPrintToFile := true;
showPrintDialog := false;
PDFSettings.author := 'author';
PDFSettings.title := 'title';
PDFSettings.openPDFFile := false;
EmailSettings.enabled := true;
EmailSettings.subject := 'emailsubject';
EmailSettings.filename := 'document.pdf';
EmailSettings.recipients.add('xxx@yyy.zz'); // my valid email address
EmailSettings.reportformat := 'pdf';
EmailSettings.previewInEmailClient := false;
EmailSettings.showEmailDialog := false;
EmailSettings.hostaddress := 'my host'; // valid host address
tppSMTPPlugin.registerClass(tppSMTPIndy);
SendMail;
end;
Any idea ?
Rbuilder 11.08 Delphi 2009
This discussion has been closed.
Comments
You most likely need to define a UsesName and Password to connect to your
server and send an email. These are also properties of the EmailSettings
object. Take a look at Demo 110 located in the \Demos\1. Reports\...
directory or the following articles on emailing reports.
http://www.digital-metaphors.com/rbWiki/Output/Email/Email_Fundementals
http://www.digital-metaphors.com/rbWiki/Output/Email/How_To...Show_Email_Errors
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com