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
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
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.
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
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.
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.
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
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;
Okay...I've solved it myself...thank you.
Best regards,
kaju
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;
...............
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?