Send mail using a variable from a 'GET' request

adriannunez

Member
Hi
I need to send a mail using form email plugin where the recipient address should be obtained with GET method.
I'm using this (the value of var1 is the user's id and it's obtained from the URL):

$jinput = JFactory::getApplication()->input;
$foo1 = $jinput->get('var1');
$db =& JFactory::getDBO();
$query_email = "SELECT email FROM p4p7n_users WHERE id LIKE $foo1 LIMIT 0,1";
$db->setQuery($query_email);
$email = $db->loadResult();
return $email;


I can see the correct email address when I use this code in a calc element, but no mail is sent on form submit.

Any ideas?
Thanks in advance.
 
The calc element won't send the mail. What are you actually using to send it?
Usually for this kind of things, I use a PHP plugin that handles both getting the mail data and sending it. You can even include a template in your PHP file to send a nice message.
 
Thanks. I'm trying to send mail using the email form plugin. I only used a calc element to test my php code (and it shows the correct email address that should be returned in the email plugin).
 
Is a mail sent if you are setting a fix mail address in "Email to" (with Email to (eval) empty)?

If yes
You can debug to see if the code is run with

Code:
...
$email=...;
 
var_dump($email);exit;

What do you get?
 
Thanks. The plugin works with a fix mail address and with a simple variable containing the email address string.
With the debug I got this error:

Notice: Undefined property: stdClass::$contactar_proveedor___date_time_raw in /home4/webperu/public_html/webs/yofestejo/components/com_fabrik/models/elementlist.php on line 529

Notice: Undefined property: stdClass::$contactar_proveedor___contactar_fecha_evento_raw in /home4/webperu/public_html/webs/yofestejo/components/com_fabrik/models/elementlist.php on line 529
NULL
 
Both elements failing are 'date' plugins. Looking at the database I can see that both dates are being stored. I just disabled both date plugins and there is no error, but still no email was sent.
 
Can you also var_dump($foo1,$email_query)?
What is your URL looking like?

Are you running a recent GitHub version?
 
I just successfully updated from the last Github version but the result is the same for the variable foo1. The other variable was mistyped, so with the correct code:


Code:
var_dump($foo1,$query_email);
exit;


Result:
NULL string(54) "SELECT email FROM p4p7n_users WHERE id LIKE LIMIT 0,1"
 
So you are calling the form via content plugin.
It seems var1 is not coming through this way.
Try
{fabrik view=form... var1=[var1]}
 
I tried with
{fabrik view=form id=13 var1=[var1]}
But still not sending an email to $email. Also, the form is not storing data in the DB.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top