SendMail and PDF Attachment
I can't seem to to properly configure RB 10.07 to properly email a report as
a pdf attachment. Everything works including email EXCEPT there is no pdf
attachment. I have tried the example in demo files and it works fine.
Below is my code. Any help would be appreciated.
Barry
With ppReport Do
Begin
ResetDevices;
ppRichText1.Clear;
ppRichText1.LoadFromRTFStream(MyStream); {and mysteam is not
null or empty}
FreeAndNil(MyStream);
DeviceType:='PDF';
AllowPrintToFile:=True;
ShowPrintDialog:=False;
PDFSettings.Author:=TLicense.FieldValues['LastName'];
PDFSettings.Title:=TLetter.FieldValues['DocumentSubject']
PDFSettings.OpenPDFFile:=False;
PDFSettings.OptimizeImageExport:=True;
EmailSettings.Enabled:=True;
EmailSettings.Attachments.Clear;
EmailSettings.Subject:=TLetter.FieldValues['DocumentSubject']
EmailSettings.FileName:='Document.Pdf';
EmailSettings.ReplyTo:=PracticeEmailAddress;
EmailSettings.Recipients.Clear;
EmailSettings.Recipients.Add(SendTo);
EmailSettings.ReportFormat:='Pdf';
EmailSettings.PreviewInEmailClient:=False;
EmailSettings.ShowEmailDialog := True;
EmailSettings.Enabled := True;
TppSMTPPlugIn.RegisterClass(TppSMTPMapi);
SendMail;
End;
a pdf attachment. Everything works including email EXCEPT there is no pdf
attachment. I have tried the example in demo files and it works fine.
Below is my code. Any help would be appreciated.
Barry
With ppReport Do
Begin
ResetDevices;
ppRichText1.Clear;
ppRichText1.LoadFromRTFStream(MyStream); {and mysteam is not
null or empty}
FreeAndNil(MyStream);
DeviceType:='PDF';
AllowPrintToFile:=True;
ShowPrintDialog:=False;
PDFSettings.Author:=TLicense.FieldValues['LastName'];
PDFSettings.Title:=TLetter.FieldValues['DocumentSubject']
PDFSettings.OpenPDFFile:=False;
PDFSettings.OptimizeImageExport:=True;
EmailSettings.Enabled:=True;
EmailSettings.Attachments.Clear;
EmailSettings.Subject:=TLetter.FieldValues['DocumentSubject']
EmailSettings.FileName:='Document.Pdf';
EmailSettings.ReplyTo:=PracticeEmailAddress;
EmailSettings.Recipients.Clear;
EmailSettings.Recipients.Add(SendTo);
EmailSettings.ReportFormat:='Pdf';
EmailSettings.PreviewInEmailClient:=False;
EmailSettings.ShowEmailDialog := True;
EmailSettings.Enabled := True;
TppSMTPPlugIn.RegisterClass(TppSMTPMapi);
SendMail;
End;
This discussion has been closed.
Comments
Try creating a simple test that does not assing any properties at runtime
and see if you can get that working correctly. Looking at your code, I do
not see anything that appears incorrect. If you still have problems, feel
free to send a small example to support@digital-metaphors.com in zip format
and I'll take a look at it for you.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com