Forums

On Submit code - after sending email - not working

Jerret 21 Mar, 2008
Hello. I'm having an issue sending another "thank you for" e-mail message after the user submits my form. I've tried using some e-mail code that I use in other portions of my website to no avail. I then tried the simple, sample code I've seen posted throughout this forum which isn't working either.

I receive no "thank you" e-mail or error message of any kind. I'm using 2.5 J1.5 RC2 on Joomla! 1.5.1. Is there a known issue with this feature that I may be unaware of? Here's the last example I tried:
<?php
  $recipient = $_POST['email'];
  $html_message = '<html>
   <head>
     <STYLE type="text/css"> 
     </STYLE>
   </head>
   <body>
    <div align="center"><br> Hello test</div>
   </body>
   </html>';
mosMail('no-reply@xyz.com', some name',$recipient, 'Thank you for volunteering', $html_message, true );
?>
Thoughts?

Best regards,
Jerret

Edited to add code tags.<br><br>Post edited by: GreyHead, at: 2008/03/21 21:31
GreyHead 22 Mar, 2008
Hi Jerret,

I think you'll find that this uses Joomla 1.0.x code and needs to be updated for Joomla 1.5.

Where are you putting this code?

What happens if you just put plain html in the 'OnSubmit after email' box?

Bob
Jerret 22 Mar, 2008
That code was pasted inside the 'Form Code', 'On Submit code - after sending email' textarea.

I've also tried the following php code which I use in other places:
<?php
	// Send e-mail
	$body 	= 'Thanks for volunteering!';
	$mail = JFactory::getMailer();
	$mail->IsHTML = true;
	$mail->ContentType = 'text/html';
	$mail->addRecipient($_POST['email'];«»);
	$mail->setSender( array( 'no-reply@xyz.com, 'xyz dot com') );
	$mail->setSubject( 'Thank you for volunteering' );
	$mail->setBody( $body );
	$sent = $mail->Send();
?>
Still nothing. As suggested I tried putting some basic text in the field but I did not notice any change. Was this text supposed to show up on the response page? I am using the Redirect URL feature. Maybe this is why the code is not executing?

Thanks for you help,
Jerret<br><br>Post edited by: GreyHead, at: 2008/03/22 01:16
Max_admin 22 Mar, 2008
Hi Jerret,

I think this line has some 2 extra '

mosMail([email]'no-reply@xyz.com[/email]', some name',$recipient, 'Thank you for volunteering, $html_message, true );

Check the correct syntax at chronocontact.php file!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 22 Mar, 2008
Hi Jerret,

There are also a couple of missing quotes in your new Joomla 1.5 code.

If you are using a Redirect URL then this email should be sent but you won't see any html, for debugging it's best to remove the redirect until you have your code working OK.

Bob
Jerret 22 Mar, 2008
The missing quotes were a result of me being sloppy when I removed my domain name from the code sample. However, I figured I should probably take a closer look just to make sure I didn't have a mistake in the production code - low and behold I had an extra semicolon!

Thank you very much for your time guys, I appriciate it and appologize for wasting your time!

Cheers,
Jerret
GreyHead 22 Mar, 2008
Hi jerret,

Good catch - I didn't see that one.

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