Forums

Emails Not Using Joomla Mailer

korireed 14 Jun, 2014
Chronoforms successfully sends emails - great!

The problem I'm experiencing is that it doesn't seem to use the Joomla configured mailer method and instead manually sends its mails through the PHP mail() function.

Is this expected behavior? How can I change this to use the Joomla configured mailer method? The need is that all site emails are sent through Mandrill and I cannot track Chronoforms-generated emails the way they are currently generated and sent.
GreyHead 14 Jun, 2014
1 Likes
Hi korireed,

CFv4 uses the Joomla! mailer, in CFv5 Max switched to make CF largely independent of the Joomla! framework so it has it's own mailer. I don't know anything about Madrill but a quick check of the docs suggest that you could probably use their API (or the Joomla! mailer) to send form emails from a Custom Code action.

Bob
korireed 14 Jun, 2014
GreyHead,

Thanks so much for your quick reply! Glad to know it's as I suspected and I wasn't doing something wrong.

In order to use the Joomla mailer I would use a custom code action... would I be writing the PHP to generate and send the email as detailed in the J! documentation here? http://docs.joomla.org/Sending_email_from_extensions

Warmest regards,
Cory
GreyHead 14 Jun, 2014
Answer
Hi korireed,

Yes that's the code, the form data is in the $form->data array so you'd use, e.g.
$mailer->addRecipient($-form->data['recipient']);
to set the To Email, and so on.

The code from the Cfv4 email action or my Email [GH] action might help here if you are familiar with PHP. Though. looking at my code, a lot of that deals with other Joomla! versions and options that you may not need. Here's the core chunk of the Joomla! 3 code
        } elseif ( $jversion->RELEASE > 2 ) {
          $mail =& JFactory::getMailer();
          $mail->setSender(array( $from_email, $from_name ));
          $mail->addRecipient($recipients);
          $mail->setSubject($subject);
          $mail->setBody($email_body);
          $mail->isHTML((bool) $sendas == 'html' );
          $mail->Encoding = 'base64';
          $mail->addAttachment($email_attachments);
          $mail->addCC($cc_emails);
          $mail->addBCC($bcc_emails);
          $mail->addReplyTo(array($replyto_email, $replyto_name));
          $email_sent = $mail->Send();
        }
As you see the variables have all been processed before from the $form->data array and the action options before this

Bob
korireed 16 Jun, 2014
Bob,

I wanted to make sure to get back to you and let you know that this has solved my problem. I greatly appreciate your assistance!

Warmest Regards,
Cory
This topic is locked and no more replies can be posted.