Send email when de value is duplicate

currucutaco 19 Feb, 2020
Hello, I have a problem when I try sent an email with duplicate values. I read the data from the db the column name is docente1, docente,2, docente3 and the rows contain the emails saved in ch forms6 .... but when the value (email) is duplicated, the email is not sent.

Is there any way to force the send email when the field is duplicate o empty
Thanks

 )

            [result] => the Mail could not be sent.
            [var] => 
        )
healyhatman 19 Feb, 2020
No, you have to remove the duplicates. It's using the Joomla mail function, which if there are duplicates simply doesn't send and returns an unhelpful "false".

You can use PHP
$all_emails = $this->get('read_data_function_name.[n].model.emailfieldname');
return array_unique($all_emails);
Then just use {var:php_block_name} for the email addresses.
currucutaco 21 Feb, 2020
Hi, thanks for the answer

I tried it on connectivity and it didn't work
healyhatman 21 Feb, 2020
Ahow debug please including the result of the code I gave you
currucutaco 21 Feb, 2020
The name function is read_pdf_data an the model name PDF
where conditions is
PDF.aid:{data:pdf_aid}
Send email when de value is duplicate image 1

using the debug mode retrieve all the emails based on aid
Send email when de value is duplicate image 2 The PHP code function
Send email when de value is duplicate image 3
And the email function
Send email when de value is duplicate image 4
Debug mode when send email
Send email when de value is duplicate image 5
healyhatman 21 Feb, 2020
Don't use the <?php tags in the PHP code block.

And since you want a whole bunch of fields you'll need to do it differently.
$keys = ['docente1', 'docente2', 'docente3', 'and all the rest of the email fields'];
$emails = [];

foreach($keys as $key) {
$emails += $this->get("read_pdf_data.[n].PDF.{$key}");
}

return array_unique($emails);
No <?php tags. There's probably a nicer way to do this but you get what you get.
This topic is locked and no more replies can be posted.