Forums

2 email layouts to 2 different email addresses

kaboomla 13 Dec, 2007
Hi,

I’m building an online registration form for a youth sports league using ChronoForms. How do I set it up so that on submit an email with a custom layout is sent to the registrants (persons filling out the form) and a separate email with a different custom layout is sent to league administrators.

William
GreyHead 13 Dec, 2007
Hi William,

This isn't supported 'out of the box' but you can fairly easily do it by writing code to send the second email and putting it in the 'OnSubmit after email' box. Here's an example from another thread:
<?php
$recipient = $_POST['client-email'];
$html_message = "<p>Hi,</p>
<p>Thank you for filling out our customer survey.</p><p>If you have any question or 
other comments, please let us know.</p>
<p>Nikhil<br />General Manager</p>
<p>DMC Car Care</p>";
$subject = $subject;
mosMail($from, $fromname, $recipient, $subject, $html_message, true, NULL, NULL, NULL, NULL, NULL );
?>
Bob
kaboomla 14 Dec, 2007
Thanks Bob,

I'll give it a try. Our form has three email fields: player, parent1, and parent2. To have the email sent to all three should the code look like this?



$recipient = $_POST['player'];
$_POST['parent1'];
$_POST['parent2'];



If the registrant does not fill out all the fields (i.e only parent1 email is provided on form) will the PHP code fail to send?

Regards,

William
GreyHead 14 Dec, 2007
Hi William,

You need the following code in the "OnSubmit before email" box:
<?php
$rows[0]->extraemail = $rows[0]->extraemail.",".$_POST['player'].",".$_POST['parent1'].",".$_POST['parent2'];
?>
This should add the all three recipients to the existing array. Not very elegant I'm afraid.

Please test it and let me know if there are any bugs.

Bob<br><br>Post edited by: GreyHead, at: 2007/12/14 00:08
YLI 24 Nov, 2008
I want to send an email to 'email' and 'sec'.
I've tried the php-script, but it doesn't work.
Here's the beginning of my php-script.
What I'am doing wrong?

<?php
$rows[0]->extraemail = $rows[0]->extraemail.",".$_POST['email'].",".$_POST['sec'];
$from = $replyto_email ="'xxxx";
$fromname = $replyto_name = "Karel V";
$recipient = $_POST['email'];
$subject = "Registration .....";

$message = '
<html>

Regards
YLI
Max_admin 24 Nov, 2008
Hi YLI,

this have completely changed in V3, this post is almost 1 year old, use 2 emails in V3.0 to do what you need, if you need more help then open a new topic please!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
YLI 14 Apr, 2009
Hi,
I'm just looking for a simple php code, to be used in chrono forms, to send the email form to 2 mailadresses: $recipient & [email]pietjepuk@hotmail.com[/email]. Please help me.
GreyHead 14 Apr, 2009
Hi YLI,

Add both a To field and a Dynamic To field to your Email setup.

Bob
YLI 14 Apr, 2009
hi Bob,
please can you give just give me the script. I'm not so good in php.
GreyHead 14 Apr, 2009
Hi YLI,

You don't need any PHP - just drag another To box into your email setup.

Bob
YLI 14 Apr, 2009
Hi Bob,

Sorry, but do you mean in the General tab?
Some posts earlier you'll see my php script from my email setup.
GreyHead 14 Apr, 2009
Hi YLI,

No I mean the Email Setup tab.

Bob
YLI 14 Apr, 2009
Hi Bob,

We're using Joomla 1.0.13 and do have a special field tab, but no email setup tab.

YLI
GreyHead 14 Apr, 2009
Hi YLI,

Ah! In that case . . . the *best* answer is to upgrade to Joomla 1.5.

If you can't do that then you'll need to add code in the OnSubmit Before box to add the second email. I'm sure that's in the forums here but many months back.

If you can't find it then ask again and I'll see if I can remember how the old version of ChronoForms works.

Bob
YLI 14 Apr, 2009
Hi Bob,
Thanks, but I'm searching this forum for months, but I'm not able to find the right solution.
Please, will you trying to remember how the old version of chronoforms works?
Yli
Max_admin 14 Apr, 2009
Hi Yli,

Search for "mosmail", this is the function which will do emails in the earlier version, so you should be able to find some posts which have this text!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.