Sent multiple emails problem

nmichalop 24 May, 2019
I have created a custom HTML form, where the administrator checks one or more users (via checkboxes).

On Submit Event I save the data in 3 different Data Tables, 1st Tbl: User(firstname, surname , email....) 2nd Tbl: Data1 3rd Tbl: Data2.

After saving I retrieve data from the different data tables with Read_data Actions.

Then I want to combine the data from the Tables Data1 & Data2 with the user's email (from the Table User) for emailing it including Data1 & Data2 fields to each email body.

For example: I want an email to be sent to:

User1 including Data1_user1info & Data2_user1info,
User2 including Data1_user2info & Data2_user2info
User3 including Data1_user3info & Data2_user3info ..........


I tried with using loop after Read_data Actions to combine and get multiple rows from different Read_data Actions but it doesn't work.

With the structure that is shown in the print screen:

Admininstrator chooses 2 users:

(User1-->user_id = 5265, Data1-->thesis_desc = K2, email = B@gmail.com, User2-->user_id = 3676, Data1-->thesis_desc = K1, email = A@gmail.com) but the email with the corresponding data only sent to User1.
​[file=12267]structure.jpg[/file]
​[file=12268]read1.jpg[/file]
​[file=12269]read2.jpg[/file]
​[file=12270]read3.jpg[/file]
nmichalop 29 May, 2019
I post again the images:

Sent multiple emails problem image 1

Sent multiple emails problem image 2

Sent multiple emails problem image 3

Sent multiple emails problem image 4



Any ideas ???
Max_admin 29 May, 2019
Hi,

First, please apply the latest update!

2nd, test the returned data from "Read data" before using it in the email action, using a "custom code" action for example.

Then use the shortcode in your email settings

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
nmichalop 29 May, 2019
First of all, thank you for your reply.

I checked that :

The results from the Read_data Actions are right,

My question is (because I have not understand the loop Action well enough), are the structure and the arguments in the loop well defined ???

Name : Loop103
Data Provider : {var:read_data29.[n].Data29.user_id}

Loop Body : {var:loop103.row}

This loop corresponds to the Read_data Action 29 and with this I want to retrieve User_Id(s) from both keys (look at read1.jpg).

PS. In the Email Action, I use loops' shortcodes ( For example, for User email {var:loop105.row} )



nmichalop 30 May, 2019
Any ideas what is going wrong???

Is it possible for each user to receive the appropriate email ???

Because with the above structure I only achieve one user to get the right email (with the combined data) or (if I change the arguments in the Loop Actions) all users get the same email....
nmichalop 31 May, 2019
I tried to retrieve data from PHP Action with SQL query and I receive the following output: 

[php126] => Array
(
[returned] => Array
(
[0] => Array
(
[0] => a@gmail.com
[userEmail] => a@gmail.com
[1] => Κ1: "......................................"
[thesis_desc] => K1 : "..............................."
)

[1] => Array
(
[0] => b@gmail.com
[userEmail] => b@gmail.com
[1] =>Κ2: "...................................."
[thesis_desc] => K2: "..................................."
)

)

[var] => Array
(
[0] => Array
(
[0] => a@gmail.com
[userEmail] => a@gmail.com
[1] => Κ1: "......................................"
[thesis_desc] => K1 : "..............................."
)

[1] => Array
(
[0] => b@gmail.com
[userEmail] => b@gmail.com
[1] =>Κ2: "...................................."
[thesis_desc] => K2: "..................................."
)

)

)
My question is : What are the structure (after PHP Action) and the arguments that I have to use in email Action to send an email to each user email , with the corresponding [thesis_desc] ???
healyhatman 31 May, 2019
The structure, as shown, is {var:php126.[index].[fieldname]}
So {var:php126.1.userEmail} would give you b@gmail.com

Also, using the following

Name : Loop103
Data Provider : {var:read_data29.[n].Data29.user_id}


Like that, in each iteration of the loop you would ONLY have the user_id available. If you do {var:read_data296} in the loop then you have the full returned data for each row abailable with {var:loop103.row.Model.field_name}
This topic is locked and no more replies can be posted.