Export to Mail with PDF att.
Hello I an trying to make a Email with an PDF file.
I have done it like the example under, and it woork fine. Then i turnd off: ShowDialog and ShowExportDialog
The mail is ok, but the PDF is gone.
Anybody?
rocedure TForm1.Mailexport(Sender: TObject);
var strm:tmemorystream;
begin
strm:=tmemorystream.Create;
tblRechnungenRGDaten.SaveToStream(strm); // loading report from table (blob-field) into stream
strm.Position:=0;
frxreport1.PreviewPages.LoadFromStream(strm); // loading report from stream into frxreport
frxreport1.ReportOptions.Name:=' any text';
frxreport1.FileName:='Filename';
strm.Free;
frxMailExport1.Address:='abcdefg@earth.xyz';
frxMailExport1.ExportFilter:=frxPDFExport1; // or other
frxMailExport1.FilterDesc:='PDF per E-Mail versenden';
frxMailExport1.FromMail:='your-email@your-domain.com';
frxMailExport1.FromCompany:='Your company';
frxMailExport1.FromName:='Your Name';
frxMailExport1.Login:='125537733'; //Login for smtp-server
frxMailExport1.Password:='*******'; //Password for smtp-server
frxMailExport1.SmtpHost:='smtp.earth.xyz';
frxMailexport1.Subject:='Subject-Text here';
frxMailexport1.Lines.Add('Hi there, '+#13#10#13#10+'heres comes an email with attached PDF);
frxpdfexport1.Author:='Name of Author';
frxpdfexport1.Subject:='Any text for PDF-Subject';
frxpdfexport1.Creator:=application.Title;
frxreport1.Export(frxMailExport1);
end;
BR Stians
I have done it like the example under, and it woork fine. Then i turnd off: ShowDialog and ShowExportDialog
The mail is ok, but the PDF is gone.
Anybody?
rocedure TForm1.Mailexport(Sender: TObject);
var strm:tmemorystream;
begin
strm:=tmemorystream.Create;
tblRechnungenRGDaten.SaveToStream(strm); // loading report from table (blob-field) into stream
strm.Position:=0;
frxreport1.PreviewPages.LoadFromStream(strm); // loading report from stream into frxreport
frxreport1.ReportOptions.Name:=' any text';
frxreport1.FileName:='Filename';
strm.Free;
frxMailExport1.Address:='abcdefg@earth.xyz';
frxMailExport1.ExportFilter:=frxPDFExport1; // or other
frxMailExport1.FilterDesc:='PDF per E-Mail versenden';
frxMailExport1.FromMail:='your-email@your-domain.com';
frxMailExport1.FromCompany:='Your company';
frxMailExport1.FromName:='Your Name';
frxMailExport1.Login:='125537733'; //Login for smtp-server
frxMailExport1.Password:='*******'; //Password for smtp-server
frxMailExport1.SmtpHost:='smtp.earth.xyz';
frxMailexport1.Subject:='Subject-Text here';
frxMailexport1.Lines.Add('Hi there, '+#13#10#13#10+'heres comes an email with attached PDF);
frxpdfexport1.Author:='Name of Author';
frxpdfexport1.Subject:='Any text for PDF-Subject';
frxpdfexport1.Creator:=application.Title;
frxreport1.Export(frxMailExport1);
end;
BR Stians
Comments
frxMailexport1.Subject:='Subject-Text here';
frxMailexport1.Lines.Add('Hi there, '+#13#10#13#10+'heres comes an email with attached PDF);
<span style='color:red'>frxpdfexport1.FileName := 'anyfile.pdf';</span> // add this line
frxpdfexport1.Author:='Name of Author';
frxpdfexport1.Subject:='Any text for PDF-Subject';