First, thanks for ChronoForms, it's an amazing addon for Joomla that's doing almost exactly what our client needs. "Almost" is the key word, and that's really just because I'm doing something wrong.
Currently, I have the form send a respond to the user filling out the form, but I also need to send an email to my client but it depends on the type of problem being reported. Basically I need to send a notification email to a different department head depending on a <select> body on the form.
So the form has a "category" select box and I created some PHP code to put in Form Code -> On Submit code after sending email. (doesn't matter if it's before or after really).
I use a switch() statement to set the $subject and $contact_email depending on the category selected, then I tried using this code stolen from another Joomla component:
$mailer =& JFactory::getMailer();
$mailer->setSender($from);
$mailer->setSubject($subject);
$mailer->setBody($body);
$mailer->IsHTML(false);
$mailer->addRecipient($contact_email);
$rs = $mailer->Send();
I also tried using what ChronoForms uses:
$email_sent = JUtility::sendMail($from, $fromname, $recipient, $subject, $html_message, true, $ccemails, $bccemails, $attachments, $replyto_email, $replyto_name );
(changing the appropriate variables)
Anyway, maybe I'm doing this the hard way, but I'm doing something wrong here.
Any thoughts, anyone?
I searched the forums, but didn't see an appropriate answer. But my brain's fried and I may just not have been looking in the right place.
Thanks in advance!
-TG
Currently, I have the form send a respond to the user filling out the form, but I also need to send an email to my client but it depends on the type of problem being reported. Basically I need to send a notification email to a different department head depending on a <select> body on the form.
So the form has a "category" select box and I created some PHP code to put in Form Code -> On Submit code after sending email. (doesn't matter if it's before or after really).
I use a switch() statement to set the $subject and $contact_email depending on the category selected, then I tried using this code stolen from another Joomla component:
$mailer =& JFactory::getMailer();
$mailer->setSender($from);
$mailer->setSubject($subject);
$mailer->setBody($body);
$mailer->IsHTML(false);
$mailer->addRecipient($contact_email);
$rs = $mailer->Send();
I also tried using what ChronoForms uses:
$email_sent = JUtility::sendMail($from, $fromname, $recipient, $subject, $html_message, true, $ccemails, $bccemails, $attachments, $replyto_email, $replyto_name );
(changing the appropriate variables)
Anyway, maybe I'm doing this the hard way, but I'm doing something wrong here.
Any thoughts, anyone?
I searched the forums, but didn't see an appropriate answer. But my brain's fried and I may just not have been looking in the right place.
Thanks in advance!
-TG