mail sending to each customers

hi,
i have more than 1000 customers.
i am sending their invoices at the end of each month by sending mail.
at the end of each month about 1000 invoices (pdf file) is created,
and i sent them one by one.
is there any way to send the invoices to corresponding to my customers at one time?

i hope i can describe my problem.

thanx for help.
have a nice day

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 12:54PM
    first design your report so that all invoices for a customer will be contained within one pdf file.
    run a query to determine the number of times the report must be run(customers who have invoices), the run the report in a loop the number of times required limiting the report to only those invoices for that customer.
  • edited 12:54PM
    Hi...

    I've nearly the same problem but don't understand, what you are saying 8-)

    My problem:

    I generate ONE report with multiple pages with data for several employees. The report is grouped by an employee-ID, so as soon as a new employee is printed, the report will start with a new page (with the help of the group-property).

    Benefit:
    The customer hits ONE button to generate a (large) report containing datasheets for all employees (maybe up to 20-30 pages). Then, he can print out the pages and give them to their employees.

    Problem:
    Now, this report should be mailed to the indivudual employees as embedded pdf's, BUT: the PDF should only contain thuch data linked to the single employee.

    I don't want to write a completly new way to separate printing from sending reports, due of the splitting process. The enduser want's to see the whole preview of all pages (containing the data of several employees) and THEN press a button to split & send the already generated reports to each employee.

    What I've done:

    I use the exportfilter to export the report to a pdf-file and attach this to an email. But: the pdf contains all pages. I took a look at the exportfilter sourcecode an see, that it's possible to export only a range of pages...but this isn't published to use from code outside.

    My idea:

    I put "metadata"-informations to the generated reports pages which contains the employee-identifier. Then, I try to read this informations and extract the first page and the last page to export. This page range should be passable to the exportfilter.

    DO YOU HAVE ANY OTHER IDEA, HOW TO SOLVE THAT...????

    Thank you so much,
    kaju
  • gordkgordk St.Catherines On. Canada.
    edited 12:54PM
    kaju
    Your situation is different.
    take a look at the interactive report demo in the demos folder use the second report to do the exporting pdf and email in the background.
  • edited 12:54PM
    hi,
    i had more than 14000 invoices and had 1172 customers.
    thats means i will have 1172 pdf files.
    so that
    1172 pdf files mean that i will send 1172 mail.
    is there any way to send 1172 invoices to 1172 different mail adresses with only one button click.
  • edited 12:54PM
    Hi...

    Thank you for answering, but how this sample should help me with my problem? I don't want an interactive report, I need to export page-ranges as pdf. Hmmm, maybe you don't understand my problem. I hope to clearify this:

    I have a big application which generates a lot of different reports triggered from many forms. A report maybe generated using native datasource, in-memory tables, custom datasets, record structures, ... Each generated report will be previewed in a centralized preview-form where the enduser can print & export this reports (bmp, word, opendocument, ...). The only variable passed to this form-class-method is TfrxReport.

    Now, the enduser will be able to email those reports in two ways:

    1) EMail the whole report with all pages to several addresses (as PDF)
    2) Split some specific reports as PDF and email only some of the pages to individual addresses

    Why? Some of the reports contain data of several employees. Each employee-data starts on a new page. Each employee has it's own email-address. Now, only the pages corresponding to a single employee should be exported and emailed.

    Situation: The whole (large) report has been already prepared and is showed on a preview-form. From THIS POINT, I had to split some special reports. I do not use the email-function from FastReport - I wrote my own one.

    My idea (example):

    - Generate the whole report (with all pages)
    - Preview this report

    THIS TWO STEPS CAN'T BE CHANGED IN MY APP!!! Then:

    - Export Page 1-3 as PDF (and email this to employee 1)
    - Export Page 4-8 as PDF (and email this to employee 2)
    - Export Page 8-10 as PDF (and email this to employee 3)
    - and so on...

    Two thinks are open:

    1) How can I include data into my report (-pages) to be able to extract the needed page-ranges (and how to extract them in a good way)?
    2) How to export a page-range to pdf?

    Regards,
    kaju
  • gordkgordk St.Catherines On. Canada.
    edited 12:54PM
    a lot will depend upon how you designed your report initially.
    the first thing to do would be to run a query to retrieve the idNo of customers that have invoices to be emailed and their email adresses.
    then run the report in a while loop.
    begin
    query1.active:= true;
    query1.first
    while not query1.eof do
    begin
    frxreport1.clear;
    frxreport1.loadfromfile('myreport.fr3');
    frxreport1.Variables := query1.idNo;
    // the line above assumes you have a variable in the report to limit the visibility to only idNo.
    frxreport1.preparereport;
    //set props for pdfexport and mailexport here

    frxMailExport1.Address:='abcdefg@earth.xyz';substitute value of query1 here
    frxMailExport1.ExportFilter:=frxPDFExport1; // or other
    frxMailExport1.FilterDesc:='PDF per E-Mail';
    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
    query1.next;
    end;
  • edited 12:54PM
    Hello.

    Okay...I've solved it myself...thank you.

    Best regards,
    kaju
  • edited 12:54PM
    gordk wrote: »
    a lot will depend upon how you designed your report initially.
    the first thing to do would be to run a query to retrieve the idNo of customers that have invoices to be emailed and their email adresses.
    then run the report in a while loop.
    begin
    query1.active:= true;
    query1.first
    while not query1.eof do
    begin
    frxreport1.clear;
    frxreport1.loadfromfile('myreport.fr3');
    frxreport1.Variables := query1.idNo;
    // the line above assumes you have a variable in the report to limit the visibility to only idNo.
    frxreport1.preparereport;
    //set props for pdfexport and mailexport here

    frxMailExport1.Address:='abcdefg@earth.xyz';substitute value of query1 here
    frxMailExport1.ExportFilter:=frxPDFExport1; // or other
    frxMailExport1.FilterDesc:='PDF per E-Mail';
    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
    query1.next;
    end;
    hi gordk again,
    i tried this code before opening this topic.
    this didnt become the solution because
    after finishing first loop, it automatically goes out of while loop
    So i can send only one time.
    i also tried this one it also doesnt work
    while not query1.eof do
    begin
    ..............
    ..............
    while not query2.eof do
    begin
    ..............
    ..............
    end
    .............
    .............
    end;
    ...............
  • gordkgordk St.Catherines On. Canada.
    edited 12:54PM
    oops move query1.next; up before the first end;
  • edited September 2013
    gordk wrote: »
    a lot will depend upon how you designed your report initially.
    the first thing to do would be to run a query to retrieve the idNo of customers that have invoices to be emailed and their email adresses.
    then run the report in a while loop.
    begin
    query1.active:= true;
    query1.first
    while not query1.eof do
    begin
    frxreport1.clear;
    frxreport1.loadfromfile('myreport.fr3');
    frxreport1.Variables := query1.idNo;
    // the line above assumes you have a variable in the report to limit the visibility to only idNo.
    frxreport1.preparereport;
    //set props for pdfexport and mailexport here

    query1.next;
    end

    end;



    When and how to use the 'mylimitingvar' variable to show only those pages which "belongs" to current idNo?

    I tried to set tag on every page on OnProgress event, and later do some loop on all pages and compare current tag and previous tag.
    But, when I write frxReport1.Report.Page[progress].Tag a can set tag for only 3 first pages (4th page have always acces violation).
    But, when I write frxReport1.Report.PreviewPages.Pages[Progress].Tag, I can set tag on all pages, but later the tag is always 0.
    Can you show good example, how to generate a pdf file after prepare every record, and later send the file by email to each adress?

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.