How to send a message to two batches of Email List - REframework

Hi team,

I’ve an RPA process in production that sends a message to multiple recipients (email addresses) at once. The shared mailbox that used to send the email out has the permission to send to a maximum of 1000 recipients per message. Now the list is growing greater than 1000 and causing a problem (failing to send). So, I have planned to split the list of mails into two batches (first batch and second batch).

I am using DataRow as a transaction item in Reframework. I want my process to send email two times (first the first batch email, second the second batch email), meaning two transactions. I am stuck here and not sure what should be the next step. Do I have to create another data table that considers DT_FirstBatch and DT_SecondBatch as first and second row?

Can anyone give me an insight?

Thanks a lot for your time.

Sisay

Hi @Sisay_Dinku

Can you try the below code

After you get the datatable the below code splits the data to your requirement then send mail

1.DT_Emails=DT.DefaultView.ToTable(False,"Email Address")   'Replace your column name
2.List_EmailsDT=DT_Emails.AsEnumerable.Chunk(2).Select(Function(a) a.copytodatatable).tolist    'Replace **2**  with your required rows i.e.,1000

BlankProcess16.zip (6.4 MB)

Cheers!!

Hi @lrtetala

Thank you for taking the time to look into this.
I’ve a couple of follow up questions with your suggestion.

  1. I see the following error in the values of list of data table expression (DT_Emails.AsEnumerable.Chunk(3).Select(Function(a) a.copytodatatable).tolist)
    Here is the error: ‘Chunk’ is not a member of ‘System.Data.Enumerable Row collection (of System.data.DataRow)’

image

  • In the above expression what does ‘Chunk(3)’ entails?
  1. When using Reframework and DataRow transaction items, which data table am I going to use for the process two send row by row (two transactions) for the two email batches?

Please let me know if you’d need more information.

Thanks!

Available when Project is set to Windows Compatibility

When Project is set to Legacy Compatibility we can work with skip/take

For learnings also have a look here:

1 Like

Hi @ppr
Thank you for clarifying that the issue is compatibility related. Also, appreciate for sharing the articles. Got it!
I’ll come to next question but for now let me ask this,
How do you re-write the above expression (DT_Emails.AsEnumerable.Chunk(3).Select(Function(a) a.copytodatatable).tolist) using Skip/Take. I am a little bit confused.

Thank you!

@ppr

Just an update: I was able to write expression for Table list for skip/take scanario.
(Enumerable.Range(0, NoOfSegments).Select(Function(x)DT_Emails.AsEnumerable.Skip(x * SegmentSize).Take(SegmentSize).CopyToDataTable).ToList())
Now my next question: How can I send the message for two email batches in Reframework? I want to envision, how that portion works.

Thanks!

Hi @ppr @lrtetala

Following up with the second question on the third post…

Hi team,
Can anyone look into this and give me insight?
@ppr @lrtetala @Yoichi

Thank you.

Hi Team

I followed the above steps and added back to another Data Table, and from there, we can use REframework with the transaction item being DataRow.

Thank you all for the effort.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.