Forums

ipn listener- send email copy to the customer but also to user unregistered of paypal

cornelio 07 Apr, 2017
Hi,
I have this in my listener email configuration:
Dynamic To: variable paypal 'payer_emal'
To: name_form_field
everything works ok

This configuration IPN sends two e-mails correctly.
therefore it presupposes that the one who pays is the one who receives the email
now I need to send the same mail also to unregistered user of Paypal, taken from a form field.

It is the case of the son who uses the PayPal account of his father, but he wants to receive email and attachments.

how I can do this?
Thanks in advance
Max_admin 07 Apr, 2017
Hi Cornelio,

You will need to save the data before the user goes to PayPal then load it back later in the "listener", this is straight forward but requires some configuration, please check this tutorial:
http://www.chronoengine.com/faqs/57-cfv4/cfv4-actions/2583-how-to-use-the-paypal-redirect-action.html

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cornelio 08 Apr, 2017
Hi Max,
Ok.
I have selected the email value from db, eg $user_emal, so I should enter this value in the 'Dynamic To', but how?

Thanks in advance
Best Regards
Max_admin 08 Apr, 2017
Hi Cornelio,

If the "db read" has "load data under model id" enabled then you can use this in the "To" box:

{Data.user_email}


Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cornelio 08 Apr, 2017
Hi Max,


I'm using a query in a custom code

Best Regards
Max_admin 08 Apr, 2017
Hi Cornelio,

So how do you get the data ? please try this:

<?php
$form->data["user_email"] = $user_email,


Then in the "To" box: {user_email}

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cornelio 08 Apr, 2017
Hi Max,
my query:

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('o_email');
$query->from($db->quoteName('#__cf_orders'));
$query->order('created_on DESC');
$query->setLimit('1');
$db->setQuery($query);
$user_mail = $db->loadResult();



Best Regards
GreyHead 08 Apr, 2017
Hi cornelio,

If I read this correctly it assumes that the email that you want is in the last record saved. This is not a reliable way of of doing this. I suggest that you add an identifier to the record when the form is first submitted, add this to the data sent to PayPal as e.g. the invoice number. Then you can use that identifier in the PayPal Listener to load the matching record to get the email (or any other info).

Bob
cornelio 08 Apr, 2017
HI Bob,

I agree with you.

...This is not a reliable way of of doing this



I must add here 'To Dynamic' email value that coming from a query in which I previously saved as ID?

Best Regards
Max_admin 08 Apr, 2017
Hi Cornelio,

Why do you use custom code? just use a "db read" and use the code I provided earlier ?

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cornelio 09 Apr, 2017
Hi Max,

certainly, I would just understand how traslate this for DBRead: $query->setlimit('1');

thank you
Max_admin 09 Apr, 2017
Hi Cornelio,

You can't control this in v5, but v6 has the option to select the first matching record only.

If you want to use v5 then you can use your custom code, you can add this line to your code:
$form->data["user_email"] = $user_email;


Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cornelio 09 Apr, 2017
Hi Max,

Your suggestion does not seem to work

to remember that we are on ipn listener.

thanks and Best Regards
Max_admin 09 Apr, 2017
Hi Cornelio,

In the "Dynamic to" you should not use "{}", just use "user_email".

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.