Form email plugin not working

Status
Not open for further replies.

Bren

Member
I recently adjusted the Email to (eval) section of my Form email plugin and then couldn't get an email to send. I decided to erase everything in the Email to (eval) section to make sure that the plugin still sends emails to the Email to email addresses; as it had before. Still no emails. This is very strange because the conditions when the emails send has not changed. I tested the related send email by manually sending emails to the Email to addresses and it worked. I also had Joomla send a test email and it worked. I just can't get the Fabirk Form Email plugin to work. Any suggestions...
Thanks in advance.
 
Hi Troester.
Yes, hardcoded. I don?t understand why it stopped working by removing the two eval code. Not even any spaces in there?


Sent from my iPhone using Tapatalk
 
Oops, I made a silly mistake in my testing. I forgot that I added a condition to trigger the email plugin only once per record. It still send emails fine; but I'm having a hard time re-witing the "Email to(Eval)" portion. I have a related dropdown join element that did list Joomla users; but my recent change (for other reasons) was to switch this to a separate employee list of names. Before the change my "Email to (EVAL)" code would select the relate joomla users email address to send the email to; per the following.
PHP:
$myResourceid = $formModel->getElementData('bw_projects___materialrequestedby', true);
$myUserid = is_array($myUserid) ? $myUserid[0] : $myUserid;
return JFactory::getUser($myUserid)->get('email');

Now I need it to do the same with the separate employee list / table. Any suggestions?
Thanks in advance.
 
Thanks for the suggestion troester. I just tried the following in my "Email to (Eval)"; but I didn't receive a test email from it after testing. I'm wondering if my syntax is off...
Code:
$myResourceid = $formModel->getElementData('bw_projects___materialrequestedby', true);
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery
    ->select('email')
    ->from('bw_resources')
    ->where('id = ' . $myDb->quote($myResourceid));
$myDb->setQuery($myQuery);
$pmjwemail = $myDb->loadResult();
return $pmjwemail;

I also receive the following error on my top of my list after testing.
Error
Unknown column 'Array' in 'where clause' SQL=SELECT email FROM bw_resources WHERE id = Array

Do you see anything I may have messed up?
Thanks in advance.
 
Last edited:
Elements like dropdowns, radio buttons, multiselects etc. are (usually) arrays, so you need to grab the first entry from that array ....

Code:
$myResourceid = $formModel->getElementData('bw_projects___materialrequestedby', true);
$myResourceid = is_array($myResourceid) ? $myResourceid[0] : $myResourceid;

-- hugh
 
Feel free you express your appreciation in the firm of a subscription. :)

Hugh


Sent from my HTC6545LVW using Tapatalk
 
You're right, Hugh. I should because you guys are such great support. I'll subscribe in the morning. Thanks again.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top