Batch email ?

Stimulsoft Reports.WEB discussion
Post Reply
JohnW
Posts: 103
Joined: Mon Nov 20, 2017 8:29 pm

Batch email ?

Post by JohnW »

I want to ask this question again. It has been some time since I last asked and I am hoping someone can give a suggestion.

For example purposes, I have a dataset has 100 rows.
- From that dataset I need to generate documents for 50 of those rows. Those documents are Stimulsoft Report with each having data unique to the particular row.
- In that dataset I also have email addresses. I need to send those 50 emails a report with their unique data. In my case I need to send them a license.
- I would like to use code to automate the process. That is the email with the report attached is sent to the email address for that row.
- Is there a way to extract that email address and place it into a sendMail process? (I see some kind of loop being used.)

I did not receive much guidance last time I posted the question, so I hope a couple of years later someone has a solution or can give some guidance.

I do not think I am the only developer who has need of something like this in their business processes.

Thanks in advance for any suggestions or guidance

John W
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Batch email ?

Post by Lech Kulikowski »

Hello,

You can process your data and render reports and send by email in your code for each row of the dataset.

> - From that dataset I need to generate documents for 50 of those rows. Those documents are Stimulsoft Report with each having data unique to the particular row.

Please provide more detailed information. Is it one report or separate reports for each row? How do you need to send emails, from code or from viewer, etc?

Thank you.
JohnW
Posts: 103
Joined: Mon Nov 20, 2017 8:29 pm

Re: Batch email ?

Post by JohnW »

It is a separate report for each row, the report contents will vary a bit. The email is in the data row as a field.

I will send the email using code and smtp. What I need is to use the email field in the data row as the Send To address. So I need the email (Send To) from the data row and pass it to the smtp process. I do not know how to trap that email address from the report data so I can use it in the code.

The report is created in the designer with conditional IF statements controlling what is presented to the recipient in the report.

I suppose I could do this in SSRS, but I really am no fan of SSRS and would like to avoid that if at all possible.

Thanks,

John W
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Batch email ?

Post by Lech Kulikowski »

Hello,

Depending on how you render the report and send it by email, do you generate one report and send each page, or generate a new report for each data record?

Thank you.
JohnW
Posts: 103
Joined: Mon Nov 20, 2017 8:29 pm

Re: Batch email ?

Post by JohnW »

It will be a new report for each email.

Edit: Just clarify, the report template is the same, the data presented to the recipient varies. In concept, think of company invoicing. Each customer will get an invoice, but the actual items being invoiced vary from customer to customer.

John W
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Batch email ?

Post by Lech Kulikowski »

Hello John,

In that case, we do not understand what the problem do you have. You can use something like the following:

//load report
report.Load();
foreach (var row in yourData)
{
// register data for each customer
report.RegData(data);
report.Render(false);

// check the Send To address information and code for send email
//
}

Thank you.
JohnW
Posts: 103
Joined: Mon Nov 20, 2017 8:29 pm

Re: Batch email ?

Post by JohnW »

I apologize if I have been misunderstanding what you have explained, but I am not clear it is giving me what I need.

- I need to read the email address from the data being presented in the report.
- For example, I have a query used to create the report, that query includes columns titled 'email', 'business name', 'address', 'amount due', 'order items'. It returns many rows of data.
- I want to email each business a report with this information (data row). The amount due, and order items vary from business to business.
- The email address I want to use in the Send To is located in the data row in the column 'email' ,which is found in each row of the dataset.

How do I properly reference the 'email' column to use it in the Send To property? The documentation does not explain how this might be done, or what classes/objects hold the data for the report.

Thanks,

John W
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Batch email ?

Post by Lech Kulikowski »

Hello,

> - I need to read the email address from the data being presented in the report.

You can store that data in the report in a variable, excelsheet, etc. And then check that values.

Thank you.
JohnW
Posts: 103
Joined: Mon Nov 20, 2017 8:29 pm

Re: Batch email ?

Post by JohnW »

I will give that a try. Hopefully, I can get it to work, I will really extend the usefulness of Stimulsoft reporting for me.

Thanks for help and your patience.

John W
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Batch email ?

Post by Lech Kulikowski »

Hello John W,

You are welcome.
Post Reply