Trouble Sending Thank You Email with Joomla 1.5

lewmaster 12 May, 2008
Hi,

I've been using this component on Joomla 1.x now for quite some time and it's been working great. I have a new 1.5 project and I need a form that will send a thank you email to the user once they have filled out the form, as well as the normal email that the admin gets. I've been using the following code in the OnSubmit After area in Joomla 1.x and it works fine:

<?php
$recipient = $_POST['email'];
$html_message = "Message Here";
$subject = " Subject Here";
mosMail($from, $fromname, $recipient, $subject, $html_message, true, NULL, NULL, NULL, NULL, NULL );
?>


However in Joomla 1.5 I get the following Error when using this code:

Fatal error: Call to undefined function: mosmail() in /homepages/17/d204522867/htdocs/components/com_chronocontact/chronocontact.php(562) : eval()'d code on line 5

Can anyone help me figure out what I need to change to get this working again?

Thanks!
Max_admin 13 May, 2008
Yes, replace mosmail with :

JUtility::sendMail( $mailfrom, $fromname, $email, $subject, $message, true );


Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
finc 13 May, 2008
I have added it in Joomla 1.5 (Legacy: 1.0)
<?php 
$recipient = $_POST['email']; 
$html_message = " Message"; 
$subject = " Subject"; 
JUtility::sendMail( $mailfrom, $fromname, $email, $subject, $message, true );
?>

but its not sending me anything :blush:
GreyHead 13 May, 2008
You've set $html_message in the preamble but used $message in the function. I think this should still give you an empty message though.

Ah, and $recipient should be $email !

Bob
lewmaster 13 May, 2008
Thanks for the fix guys, it worked great. Just one more small problem - if I add a URL to the Redirect URL field under the Form URLs tab, the thank you email will not send. I do still get the admin email. When I leave that field blank, I get both emails. Is there any way I can use this code and still have both emails send normally?

Thanks for the help!
GreyHead 14 May, 2008
Hi lewmaster,

A Redirect URL shouldn't stop the emails being sent - it is the last thing that ChronoForms does (after the 'OnSubmit after email' code).

Puzzled?? Please take a Form Backup of your form from the CF Forms Manager and email it to me at the address in my sig.

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

VPS & Email Hosting 20% discount
hostinger