Error on sending e-mail to validate user registration

ianmaciel 13 Apr, 2013
I created a CF to user registration.

When I try to register a user using the form, it returns to a PHP error message:

Fatal error: Call to undefined method JUtility::sendMail() in /home/storage/8/0f/0d/damianikoerich6/public_html/exemplo/administrator/components/com_chronoforms/form_actions/joomla_registration/joomla_registration.php on line 271



Does any one know how to fix it?

ps. I have others CF and the those send e-mail correctly. The user registration is the only one that appears this error.
GreyHead 14 Apr, 2013
Hi ianmaciel,

Which version of Joomla! is this? If it is version 3.0 then it's probably a ChronoForms bug as the old email method has been deprecated.

Bob
ianmaciel 14 Apr, 2013
Yes, exactly. I'm running Joomla 3.0.3.

How can I chance it to the new method?
ianmaciel 16 Apr, 2013
Any ideas?

I know php but I don't know Joomla methods and functions...

If anyone could help me giving me the guidelines I could fix the code.

Thanks,
Ian
ianmaciel 16 Apr, 2013
I found some information saying to change 'JUtily::sendMail' by 'JMail::getInstance()->sendMail'.

I changed so it stopped displaying error but no e-mail are sent (it is supposed to send an activation e-mail).

Any ideas?
GreyHead 22 Apr, 2013
Hi ianmaciel,

That looks like the correct fix to me. Whether or not it sends emails depends on how you have the action configured. By default the standard Joomla! emails are used I think.

Bob

Here's the code change I worked out. Find this code about line 217 of /administrator/components/com_chronoforms/form_actions/joomla_registration/joomla_registration.php
$return = JUtility::sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody);
and replace it with
$mail =& JFactory::getMailer();
$return = $mail->sendMail( $data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody );

Bob
ianmaciel 23 Apr, 2013
Then I get the error saying the body of the message is empty.


Warning: sprintf() [function.sprintf]: Too few arguments in /home/storage/8/0f/0d/damianikoerich6/public_html/exemplo/libraries/joomla/language/text.php on line 235



:(
GreyHead 23 Apr, 2013
Hi ianmaciel,

Hmmm . . . that's a PHP Warning, not technically an error and it's in the Joomla! language handling code which ChronoForms doesn't use. It's possible it's called from somewhere in the Mailer code though.

Easiest solution is to set the site Error Reporting to System Default or None when you go live.

Bob
This topic is locked and no more replies can be posted.