Email pdf report

Henrik LyderHenrik Lyder Chaska, Minnesota USA
edited April 2011 in FastReport 4.0
I would like to programatically create and send a pdf as an email attachment.

I have placed components TfrxReport, TfrxMailExport and TfrxPFDExport on a form in delphi 2010 using FastReport 4.10.18

using the code

frxReport1.LoadFromFile('nameofreport.fr3')
frxReport1.preparereport;
frxMail.Subject := 'test attachment ';
frxMail.FromName := 'my name';
frxMail.FromMail := 'myddress@mydomain.com';
frxMail.Address := 'receiver@mydomain.com';
frxMail.FromCompany := 'my company';
frxMail.Login := 'myaddress@mydomain.com';
frxMail.Password := 'password';
frxMail.SmtpHost := 'smtp.mydomain.com';
frxMail.SmtpPort := 587;

frxMail.useIniFile := false;
frxMail.ExportFilter := frxPDFExport;
frxMail.ShowDialog := false;
frxReport1.Export(frmMail);


This approach works but I am unable to set multiple receipients (seperate by ; )


Regards

Henrik Lyder

Comments

  • gpigpi
    edited 11:52PM
    Try to set frxMailExport1.UseIniFile to False
    frxMailExport1.Address:='login1@gmail.com';
         frxMailExport1.FromCompany:='Company';
         frxMailExport1.FromMail:='login2@yandex.ru';
         frxMailExport1.FromName:='Paul';
         frxMailExport1.Lines.Clear;
         frxMailExport1.Lines.Add('Message');
         frxMailExport1.Login:='login2@yandex.ru';
         frxMailExport1.Password:='_password_';
         frxMailExport1.SmtpHost:='smtp.yandex.ru';
         frxMailExport1.Subject:='test';
         frxMailExport1.Signature.Clear;
         frxMailExport1.Signature.Add('Signature');
         frxMailExport1.ExportFilter:=frxPDFExport1;
         frxMailExport1.UseIniFile:=False;
         frxMailExport1.ShowDialog:=False;
         frxMailExport1.ShowExportDialog:=False;
         frxReport1.PrepareReport();
         frxReport1.Export(frxMailExport1);
    
  • Henrik LyderHenrik Lyder Chaska, Minnesota USA
    edited 11:52PM
    Thanks a bunch, got me much closer - now I only need to specify multiple receipients ..

    gpi wrote: »
    Try to set frxMailExport1.UseIniFile to False
    frxMailExport1.Address:='login1@gmail.com';
         frxMailExport1.FromCompany:='Company';
         frxMailExport1.FromMail:='login2@yandex.ru';
         frxMailExport1.FromName:='Paul';
         frxMailExport1.Lines.Clear;
         frxMailExport1.Lines.Add('Message');
         frxMailExport1.Login:='login2@yandex.ru';
         frxMailExport1.Password:='_password_';
         frxMailExport1.SmtpHost:='smtp.yandex.ru';
         frxMailExport1.Subject:='test';
         frxMailExport1.Signature.Clear;
         frxMailExport1.Signature.Add('Signature');
         frxMailExport1.ExportFilter:=frxPDFExport1;
         frxMailExport1.UseIniFile:=False;
         frxMailExport1.ShowDialog:=False;
         frxMailExport1.ShowExportDialog:=False;
         frxReport1.PrepareReport();
         frxReport1.Export(frxMailExport1);
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.