Export to Mail with PDF att.

edited 12:23PM in FastReport 3.0
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

Comments

  • SamuraySamuray Administrator
    edited 12:23PM
    The property TfrxPdfExport.FileName can not be blank.

    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';

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.