On the previous discussion, we've created a working copy of selecting ONE recipient of a list of multiple recipients.
Well, my client want to offer people a choice of more than one recipients on the list. In other word, if someone were to send an email to 3 out of 19 people on the list, then all 3 people should receive the email and not make the people do it one at a time three times.
Unfortunately, I cannot make that option work, because the end result is ZERO emails are sent out!
I've upgraded to 2.3.5 latest 1.0 version tonight.
So, is this possible at all?
Form HTML code:
On Submit code - before sending email:
Thanks for the assistance!
Well, my client want to offer people a choice of more than one recipients on the list. In other word, if someone were to send an email to 3 out of 19 people on the list, then all 3 people should receive the email and not make the people do it one at a time three times.
Unfortunately, I cannot make that option work, because the end result is ZERO emails are sent out!
I've upgraded to 2.3.5 latest 1.0 version tonight.
So, is this possible at all?
Form HTML code:
<?php
global $mainframe;
$mainframe->setPageTitle("Contact a Teacher"«»);
?>
<input type="hidden" name="subject" value="Contact a Teacher Form" />
<p>Select the teacher you wish to contact:
</p>
<label>
<select name="recipients" size="19" multiple="multiple" id="teacher">
<option value="em1">John Smith</option>
<option value="em2">Lisa Smith</option>
<option value="em3">Rochelle Smith</option>
<option value="em4">Megan Smith</option>
<option value="em5">Eve Smith</option>
<option value="em6">Ken Smith</option>
<option value="em7">Arlene Jones</option>
<option value="em8">Harry Jones</option>
<option value="em9">Zack Smith</option>
<option value="em10">Jerry Lai</option>
<option value="em11">Eleanor Jones</option>
<option value="em12">Jacqueline Smith</option>
<option value="em13">George Smith</option>
<option value="em14">Mary Smith</option>
<option value="em15">Janie Jones</option>
<option value="em16">Dave Smith</option>
<option value="em17">Susan Smith</option>
<option value="em18">Barbara Smith</option>
<option value="em19">Lauren Smith</option>
<option value="em20">Webmaster</option>
</select>
</label>
</p>
<p>Hold down "Ctrl" key and use your left-hand mouse button to select more than
one teacher
</p>
<p>Enter your name:
<input name="name" type="text" size="25" />
<br />
Email address:
<input name="email" type="text" id="email" size="25" />
<br />
Telephone Number:
<input name="telephone" type="text" id="telephone" size="25" />
<br />
Message:
<label>
<textarea name="message" id="message"></textarea>
</label>
</p>
<p>
<input name="This email was filled out at the website" type="submit" class="button" value="Submit" />
</p>
On Submit code - before sending email:
<?php
$emails = array('em1' => 'Lisa@deafbiz.com', 'em2' => 'arlene@deafbiz.com', 'em3' => 'barbara@deafbiz.com', 'em4' => 'dave@deafbiz.com',
'em5' => 'einav@deafbiz.com', 'em6' => 'eleanor@deafbiz.com', 'em7' => 'hope@deafbiz.com', 'em8' => 'jacqueline@deafbiz.com',
'em9' => 'jaklyn@deafbiz.com', 'em10' => 'janie@deafbiz.com', 'em11' => 'jerry@deafbiz.com', 'em12' => 'ken@deafbiz.com', 'em13' => 'lauren@deafbiz.com', 'em14' => 'lowy@deafbiz.com', 'em15' => 'megan@deafbiz.com', 'em16' => 'miriam@deafbiz.com', 'em17' => 'rochelle@deafbiz.com', 'em18' => 'susan@deafbiz.com', 'em19' => 'zippy@deafbiz.com', 'em20' => 'webmaster@deafbiz.com');
$rows[0]->extraemail = $emails[$_POST['recipients']];
?>
Thanks for the assistance!
Hi deafbiz,
Please will you turn debug on and tell me what shows up in $_POST (the first line in the debug output). I think we probably need to convert the $_POST['recipients'] array back into a string but lets check what's there first.
Bob
Please will you turn debug on and tell me what shows up in $_POST (the first line in the debug output). I think we probably need to convert the $_POST['recipients'] array back into a string but lets check what's there first.
Bob
Hi deafbiz,
Hmm, do you have a redirect URL? If so please remove it temporarily. You should see an output page when you submit the form.
Bob
PS to Max: (in a future version we need to fix this so that debug intercepts the redirect)<br><br>Post edited by: GreyHead, at: 2007/11/04 15:29
Hmm, do you have a redirect URL? If so please remove it temporarily. You should see an output page when you submit the form.
Bob
PS to Max: (in a future version we need to fix this so that debug intercepts the redirect)<br><br>Post edited by: GreyHead, at: 2007/11/04 15:29
Yep, didn't realize that was the culprit.
Here's the debug:
_POST: Array ( [subject] => Contact a Hillel Teacher Form [recipients] => em20 [name] => Judy Gunter [email] => [email]jsg@winfreepcs.com[/email] [telephone] => n/a [message] => test, please ignore [This_email_was_filled_out_at_the_Hillel_website] => Submit )
Case 1: Use table layout
E-mail: 'Yes' custom
Email sent
Note: I've selected the last 3 on the list. It always sends email to the last one on the list. So that means the first and second choices I've selected never received the emails. Is this a helpful clue?<br><br>Post edited by: deafbiz, at: 2007/11/04 15:54
Here's the debug:
_POST: Array ( [subject] => Contact a Hillel Teacher Form [recipients] => em20 [name] => Judy Gunter [email] => [email]jsg@winfreepcs.com[/email] [telephone] => n/a [message] => test, please ignore [This_email_was_filled_out_at_the_Hillel_website] => Submit )
Case 1: Use table layout
E-mail: 'Yes' custom
Email sent
Note: I've selected the last 3 on the list. It always sends email to the last one on the list. So that means the first and second choices I've selected never received the emails. Is this a helpful clue?<br><br>Post edited by: deafbiz, at: 2007/11/04 15:54
Hi deafbiz,
Ahh . . . please try changing the name to 'recipients[]' e.g.
Bob
Ahh . . . please try changing the name to 'recipients[]' e.g.
<select name="recipients[]" size="19" multiple="multiple" id="teacher">
I don't think that will completely fix it but hopefully we'll see all the names in the $_POST array.
Bob
This is the results after using your suggestion:
_POST: Array ( [subject] => Contact a Hillel Teacher Form [recipients] => Array ( [0] => em18 [1] => em19 [2] => em20 ) [name] => Judy Gunter [email] => [email]jsg@winfreepcs.com[/email] [telephone] => n/a [message] => test [This_email_was_filled_out_at_the_Hillel_website] => Submit )
Case 1: Use table layout
Warning: Illegal offset type in /home/xxxxxx/public_html/components/com_chronocontact/chronocontact.php(379) : eval()'d code on line 5
E-mail: 'Yes' custom
Email not sent
_POST: Array ( [subject] => Contact a Hillel Teacher Form [recipients] => Array ( [0] => em18 [1] => em19 [2] => em20 ) [name] => Judy Gunter [email] => [email]jsg@winfreepcs.com[/email] [telephone] => n/a [message] => test [This_email_was_filled_out_at_the_Hillel_website] => Submit )
Case 1: Use table layout
Warning: Illegal offset type in /home/xxxxxx/public_html/components/com_chronocontact/chronocontact.php(379) : eval()'d code on line 5
E-mail: 'Yes' custom
Email not sent
Hi deafbiz,
Good, that gets all the addresses returned to ChronoForms. One more step needed I think. Please change the Onsubmit code to this:
Bob
Good, that gets all the addresses returned to ChronoForms. One more step needed I think. Please change the Onsubmit code to this:
<?php
$emails = array('em1' => 'Lisa@deafbiz.com', 'em2' => 'arlene@deafbiz.com', 'em3' => 'barbara@deafbiz.com', 'em4' => 'dave@deafbiz.com',
'em5' => 'einav@deafbiz.com', 'em6' => 'eleanor@deafbiz.com', 'em7' => 'hope@deafbiz.com', 'em8' => 'jacqueline@deafbiz.com',
'em9' => 'jaklyn@deafbiz.com', 'em10' => 'janie@deafbiz.com', 'em11' => 'jerry@deafbiz.com', 'em12' => 'ken@deafbiz.com', 'em13' => 'lauren@deafbiz.com', 'em14' => 'lowy@deafbiz.com', 'em15' => 'megan@deafbiz.com', 'em16' => 'miriam@deafbiz.com', 'em17' => 'rochelle@deafbiz.com', 'em18' => 'susan@deafbiz.com', 'em19' => 'zippy@deafbiz.com', 'em20' => 'webmaster@deafbiz.com');
$em_array= array();
foreach ( $_POST['recipients'] as $em ) {
$em_array[] = $emails[$em];
}
$rows[0]->extraemail = implode(",", $em_array);
?>
This looks up the emails in the array, puts them in a new array then turns that into a comma separated list for ChronoForms. Not very elegant but hopefully it will work OK.
Bob
I ran a quick test. There's 20 on the list. I selected 19 but only 7 came through. Is there a limitation?
Hi deafbiz,
I don't think that there's anything in ChronoForms that would limit it, possibly the MosMail limits the field length or the number of addresses.
Where are you seeing the 7 - in the debug report or in the mail sent?
Bob
I don't think that there's anything in ChronoForms that would limit it, possibly the MosMail limits the field length or the number of addresses.
Where are you seeing the 7 - in the debug report or in the mail sent?
Bob
I ran a second test and this time all emails went through. However, if there's a way to limit to say 7 emails at one time, that'll be great so that it won't trigger spam alerts by some idiot that's messing with us. If not, no biggie deal.
And I also tested the reply so each person that recives it will be able to respond to that sender, so that's cool.
One more question, in the cc field is there a way to use name instead of email address? Of course when hitting the reply, the name and email address will show up. If that's not a possibility, no biggie either.
All in all I think this one works so will double check now with REAL email addreses.
And I also tested the reply so each person that recives it will be able to respond to that sender, so that's cool.
One more question, in the cc field is there a way to use name instead of email address? Of course when hitting the reply, the name and email address will show up. If that's not a possibility, no biggie either.
All in all I think this one works so will double check now with REAL email addreses.
Hi deafbiz,
Glad it all seems to be working.
If you want to limit to say 7 emails then you could trim the email array in the Onsubmit code with
Bob
Glad it all seems to be working.
If you want to limit to say 7 emails then you could trim the email array in the Onsubmit code with
$max_em = 7;
if ( count($em_array) > $max_em ) {
$em_array = array_rand($em_array, $max_em);
}
Put this just before the $rows[0] line and it will randomly pick 7 out of the emails selected selected.
Bob
Here's an update for 2010 (almost 2011):
I'm still using the old CF 2.5.
The form no longer works for multiple recipients. I have no idea why. Been working fine but not anymore.
So here's what I have:
Joomla 1.5.21 with Legacy
Form HTML:
On Submit code
Yes, the redirect goes to a "Thank You" article page
This website is in Joomla built-in SEF.
Anti-Spam is on, Validation is off.
Thank you for the assistance.
I'm still using the old CF 2.5.
The form no longer works for multiple recipients. I have no idea why. Been working fine but not anymore.
So here's what I have:
Joomla 1.5.21 with Legacy
Form HTML:
<?php
global $mainframe;
$mainframe->setPageTitle("Contact a Hillel Teacher");
?>
<input type="hidden" name="subject" value="Contact a Hillel Teacher Form" />
<p>Select the teacher you wish to contact:
</p>
<label>
<select name="recipients" size="20" multiple="multiple" id="teacher">
<option value="em1">Teacher 1</option>
<option value="em2">Teacher 2 </option>
<option value="em3">Teacher 3</option>
.
.
.
<option value="em19">Webmaster</option>
</select>
</label>
</p>
<p>Hold down "Ctrl" key and use your left-hand mouse button to select more than
one teacher
</p>
<p>Enter your name:
<input name="name" type="text" size="25" />
<br />
Email address:
<input name="email" type="text" id="email" size="25" />
<br />
Telephone Number:
<input name="telephone" type="text" id="telephone" size="25" />
<br />
Message:
<label>
<textarea name="message" id="message" COLS=40 ROWS=6></textarea>
</label>
</p>
<td>Please type in the anti-spam code: {imageverification}</td>
<p>
<input name="This email was filled out at the Hillel website" type="submit" class="button" value="Submit" />
</p>
On Submit code
<?php
$emails = array('em1' => 'email@gmail.com',
'em2' => 'email2@gmail.com',
'em3' => 'email3@gmail.com',
.
.
.
'em19' => 'email19@gmail.com');
$rows[0]->extraemail = $emails[$_POST['recipients']];
?>
Yes, the redirect goes to a "Thank You" article page
This website is in Joomla built-in SEF.
Anti-Spam is on, Validation is off.
Thank you for the assistance.
Hi deafbiz,
Looks like a gremlin changed the code. At the end of the On Submit code you have
Bob
Looks like a gremlin changed the code. At the end of the On Submit code you have
$rows[0]->extraemail = $emails[$_POST['recipients']];
whereas it should be $em_array= array();
foreach ( $_POST['recipients'] as $em ) {
$em_array[] = $emails[$em];
}
$rows[0]->extraemail = implode(",", $em_array);
Bob
Thanks for the quick response, but it didn't work.
I never received the email directed to webmaster. I did receive email directed to my other email (gmail) as if I were trying to contact the webmaster.
Also when I reply from gmail, I see my gmail address as TO: when it really should've been the webmaster email address. In other words, I'm replying to myself.
I think something else is missing.
I never received the email directed to webmaster. I did receive email directed to my other email (gmail) as if I were trying to contact the webmaster.
Also when I reply from gmail, I see my gmail address as TO: when it really should've been the webmaster email address. In other words, I'm replying to myself.
I think something else is missing.
Hi deafbiz ,
Sounds as though you need to go through line by line checking the code and testing the outputs to see exactly what is happening.
Bob
Sounds as though you need to go through line by line checking the code and testing the outputs to see exactly what is happening.
Bob
This topic is locked and no more replies can be posted.