I've tried using the code shown at http://www.chronoengine.com/faqs/52-cfv4/cfv4-emails/2603-how-can-i-send-an-email-to-different-addresses.html to send form responses to more than one email address at a time, based on the selections made from a set of checkboxes, but it is only sending to the last selected email in the list.
I am using parts a, b, and c of the code in the CFV5 section.
Any ideas?
Thanks, Peter
I am using parts a, b, and c of the code in the CFV5 section.
Any ideas?
Thanks, Peter
Hi Peter,
I believe that the CFv5 mailer in the latest releases will handle a list of email addresses. What do you see in the Email To when you add a Debugger action to the On Submit event.
Bob
I believe that the CFv5 mailer in the latest releases will handle a list of email addresses. What do you see in the Email To when you add a Debugger action to the On Submit event.
Bob
Hi Bob,
Thanks for looking into this.
Should I be using v4 instead of v5?
Here's what shows when I include the debugger action in the CFv5 form, when I have selected three options that should send the same email to three different email addresses:
Peter
Data Array
Thanks for looking into this.
Should I be using v4 instead of v5?
Here's what shows when I include the debugger action in the CFv5 form, when I have selected three options that should send the same email to three different email addresses:
Peter
Data Array
Array
(
[option] => com_chronoforms5
[chronoform] => VCE_Toolbox_contact_form
[event] => submit
[firstname] => peter
[surname] => batchelor
[year] => Eleven
[school] =>ABC
[street] => Smith St
[town] => Smithville
[postcode] => 1234
[email] => it@vate.org.au
[recipients] => em3
[submit] => Submit
[email_to_use] => peterbat@bigpond.net.au
[ip_address] => 58.160.76.80
)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
[2] => Array
(
[Email] => Array
(
[0] => An email with the details below was sent successfully:
[1] => To:peterbat@bigpond.net.au
[2] => Subject:VCE Toolbox
[3] => From name:VCE Toolbox form
[4] => From email:peter@batchelors.net
[5] => CC:
[6] => BCC:
[7] => Reply name:
[8] => Reply email:
[9] => Attachments:
[10] => Array
(
)
[11] => Body:
<table>
<tr><td>First name</td><td>peter</td></tr>
<tr><td>Surname</td><td>batchelor</td></tr>
<tr><td>Year level</td><td>Eleven</td></tr>
<tr><td>School</td><td>ABC</td></tr>
<tr><td>Street address</td><td>Smith St</td></tr>
<tr><td>Suburb or town</td><td>Smithville</td></tr>
<tr><td>Postcode</td><td>1234</td></tr>
<tr><td>Email</td><td>it@vate.org.au</td></tr>
<tr><td>Subjects</td><td>em3</td></tr>
</table><br /><br />IP: 58.160.76.80
)
)
)
Hi Peter,
Sorry, CFv4 was my typo :-( Now fixed.
There's only one address making it into email_to_use so something isn't working in your Custom Code. What do you have there?
Bob
Sorry, CFv4 was my typo :-( Now fixed.
There's only one address making it into email_to_use so something isn't working in your Custom Code. What do you have there?
Bob
Hi Bob,
the custom code is:
The email action is placed after the custom code action.
It uses email_to_use as the dynamic to address.
The email template uses the following:
the custom code is:
<?php
// set a default recipient
$recipient = 'em1';
if (isset($form->data['recipients']) && $form->data['recipients']) {
$recipient = $form->data['recipients'];
}
$emails = array (
'em1' => 'peter@batchelors.net',
'em2' => 'peter@i-t-services.net',
'em3' => 'peterbat@bigpond.net.au' );
$form->data['email_to_use'] = $emails[$recipient];
?>
The email action is placed after the custom code action.
It uses email_to_use as the dynamic to address.
The email template uses the following:
<table>
<tr><td>First name</td><td>{firstname}</td></tr>
<tr><td>Surname</td><td>{surname}</td></tr>
<tr><td>Year level</td><td>{year}</td></tr>
<tr><td>School</td><td>{school}</td></tr>
<tr><td>Street address</td><td>{street}</td></tr>
<tr><td>Suburb or town</td><td>{town}</td></tr>
<tr><td>Postcode</td><td>{postcode}</td></tr>
<tr><td>Email</td><td>{email}</td></tr>
<tr><td>Subjects</td><td>{recipients}</td></tr>
</table>
Hi Peter,
But that code will only return one email address. I thought that you wanted several?
Bob
But that code will only return one email address. I thought that you wanted several?
Bob
Hi Bob,
The details at https://www.chronoengine.com/faqs/52-cfv4/cfv4-emails/2603-how-can-i-send-an-email-to-different-addresses.html say that you can use a select box element, so I assumed that this meant that it would work to several selections at once.
Is there a way of getting the form to use check boxes to allow the form to be sent to all of the email addresses selected?
Thanks, Peter
The details at https://www.chronoengine.com/faqs/52-cfv4/cfv4-emails/2603-how-can-i-send-an-email-to-different-addresses.html say that you can use a select box element, so I assumed that this meant that it would work to several selections at once.
Is there a way of getting the form to use check boxes to allow the form to be sent to all of the email addresses selected?
Thanks, Peter
Hi Peter,
Yes, you'll need to edit the PHP to return a comma separated list of addresses.
Bob
Yes, you'll need to edit the PHP to return a comma separated list of addresses.
Bob
This topic is locked and no more replies can be posted.