I have a simple form that has four actions:(1) sending to a defined email address, (2) sending to the user's provided email address, (3) running some PHP code to subscribe the user to AcyMailing and (4) redirecting to a thank you page.Everything works correctly except for the second action. The name of the "Email" field on my form is "email". However if I try to dynamically set the recipient email action to {data:email} upon submission the form stalls for a few seconds and then give me a "Could not instantiate mail function" error page. You can see the front-end of the form here - https://gamedayvideos.com/become-an-affiliate. I've also attached screenshots of the form's Designer and Submit tabs showing details.


Enable the form debug, then in the Email behaviors, enable "Print", for both emails, then both emails will not be sent and will be displayed after submission, compare the debug of both email messages, what are the differences ? is the recipient captured correctly ?
Thanks. I figured it out.
Could you please post the solution for other users ?
Thank you!
No matter what I did, using the {data:email} shortcode in the "Recipient" field of an email action gave an error.So instead I wrote some custom PHP that sends the user email manually. For anyone who's interested, here's the code:
// Retrieve the form data
$email = $this->data('email'); // Replace 'email' with the actual form field name
// Ensure the email and preferred_code fields are not empty
if (!empty($email) && !empty($preferredCode)) {
// Get Joomla mailer object
$mailer = \JFactory::getMailer();
// HTML content for the email body
$htmlBody = <<<HTML
// [INSERT THE BODY OF YOUR EMAIL AS HTML CODE HERE]
HTML;
// Configure and send the email
$mailer->addRecipient($email);
$mailer->setSubject('Your Email Subject');
$mailer->setBody($htmlBody);
$mailer->isHtml(true); // Ensure the email is sent as HTML
$mailer->setSender(['your@domain.com', 'Your Name']);
// Send the email and handle errors
if (!$mailer->send()) {
\JFactory::getApplication()->enqueueMessage('Failed to send confirmation email.', 'error');
} else {
\JFactory::getApplication()->enqueueMessage('Confirmation email sent successfully!', 'message');
}
} else {
// Log an error if required fields are missing
\JFactory::getApplication()->enqueueMessage('Email or affiliate code is missing. Cannot send confirmation email.', 'error');
}
does the "Sender" info match those in your Joomla global config ? Chronoforms will also use the Joomla function for sending the mail, but the "From" is either taken from Joomla config or your Action setup if it's there, so maybe the from email was not the correct one
Max,Yes. I triple-checked that. They were all the same. I do have a variety of other content plugins installed on the site related to other components. So I'm wondering if the issue wasn't caused by a conflict that caused the {data:email} shortcode to not work correctly.In my circumstance it was just easier to write custom PHP code to handle the user email vs. track down whatever was going on with the plugins.
I can not tell without checking the debug unfortunately, the debug with Print behavior would have shown the email final settings