I am trying to get a form that is sent to one person, to also get CC'd to two other people. The two other people are captured on the form. My initial attempt was to put the two field names as a comma separated list in the Special CC field... but this did not work.
So I checked the FAQ and it mentioned using an array of addresses... but I do not know how to accomplish this.
Not knowing didn't prevent me from trying tho... here is what I attempted...
Special Fields
CC Field: recipients
Form Code
On Submit
... and of course it did not work. So please let me know how to properly use an array to build the multiple address list off of my form fields.
FYI... I am using ChronoForms V2.5 J1.5 RC2.1
So I checked the FAQ and it mentioned using an array of addresses... but I do not know how to accomplish this.
Not knowing didn't prevent me from trying tho... here is what I attempted...
Special Fields
CC Field: recipients
Form Code
<input type="hidden" name="recipients" value="">
<input type="hidden" name="EmpEmail" value="<?php echo $user->email?>">
<input name="EmpEmail2" size="50" value="">
On Submit
<?php
$address_array = array($_POST['EmpEmail'],$_POST['EmpEmail2']);
$_POST['recipients'] = $address_array;
?>
... and of course it did not work. So please let me know how to properly use an array to build the multiple address list off of my form fields.
FYI... I am using ChronoForms V2.5 J1.5 RC2.1
The two other people are captured on the form
you mean the user enter them or they are stored at some hidden fields ?
Ah, I had hoped the code snippets would have helped there.
[list=1]The person filling in the form is a hidden field that pulls the logged in users e-mail... EmpEmail The second field is a manually entered input stored in EmpEmail2 [/list:o]
[list=1]
Ok, at the onsubmit before email :
note that this could be much easier with V3.0 if you are familiar with the emails interface!
Cheers
max
<?php
$rows[0]->extraemail .= $_POST['EmpEmail'].','$_POST['EmpEmail2'];
?>
note that this could be much easier with V3.0 if you are familiar with the emails interface!
Cheers
max
I couldn't get your code to work and wonder if the "fix" might be related to other code I needed to add once before.
In a previous form, I needed to get around chronoform dermanding a value in the General - Email Address(es): field and use only the field associated to the Special fields - Email field:... to do this, the following code was used...
looks like we are doing something similar to the first line of this older code... might we also need an unset line?
In a previous form, I needed to get around chronoform dermanding a value in the General - Email Address(es): field and use only the field associated to the Special fields - Email field:... to do this, the following code was used...
<?php
$rows[0]->extraemail = $_POST[$paramsvalues->emailfield];
unset ($paramsvalues->emailfield);
?>
looks like we are doing something similar to the first line of this older code... might we also need an unset line?
the final code should be like this :
<?php
$rows[0]->extraemail = $_POST[$paramsvalues->emailfield];
unset ($paramsvalues->emailfield);
$rows[0]->extraemail .= ",".$_POST['EmpEmail'].','.$_POST['EmpEmail2'];
?>
Thanks for the reply Max. Unfortunately this code did not work for me either... I should mention that I assumed I was supposed to clear the Special fields - CC field:
Just thinking out loud here... I am trying to "impact" the CC email "field"... so should the code still be targeting emailfield?
Just thinking out loud here... I am trying to "impact" the CC email "field"... so should the code still be targeting emailfield?
Regarding the code above, did you have all fields and the special fields email field filled with correct data ?
how it was setup the last time it was working ?
how it was setup the last time it was working ?
I only offered the previous "code" as an example to maybe troubleshoot what I am trying to accomplish... the old code was used to override the "TO" email address which is forced to have a value in my version of chronoforms.
This time, I am trying to get 2 e-mail addresses in the CC of the e-mail sent. the addresses are collected in the form, and my original attempt was to build an array to assign to variable/field that I could put into the Special CC field.
Your first possible solution seemed to manipulate some "system" values, so I figured I could remove my variable/field in the Special CC field.
I think it is easier to say "let's ignore the code in this thread" as I am certainly not a coder (hack at best) and start over with a new question... I am capturing 2 e-mail addresses as inputs on a form, how can I get both of these address on the CC "line" when the form is e-mailed on submit?
This time, I am trying to get 2 e-mail addresses in the CC of the e-mail sent. the addresses are collected in the form, and my original attempt was to build an array to assign to variable/field that I could put into the Special CC field.
Your first possible solution seemed to manipulate some "system" values, so I figured I could remove my variable/field in the Special CC field.
I think it is easier to say "let's ignore the code in this thread" as I am certainly not a coder (hack at best) and start over with a new question... I am capturing 2 e-mail addresses as inputs on a form, how can I get both of these address on the CC "line" when the form is e-mailed on submit?
Ok, this line should work first before we can go any far :
add it to the onsubmit before email box, you have V2.5 RC3.1, correct ?
$rows[0]->extraemail = $_POST['EmpEmail'].','.$_POST['EmpEmail2'];
add it to the onsubmit before email box, you have V2.5 RC3.1, correct ?
ok, test it and see, I can't remember how was RC2.1 different, if it doesn't work then backup ur files and overwrite it with the RC3.1 files and let me know!
This code is getting some where... I noticed the code is this snippet is just "=" and not ".="... the two email addresses where successfully added... but they overwrote the "TO"... what tweak do we need to make to push it down to the CC line?
Hi, did the 2 emails got the email received or not ?
Yes they did get the e-mails, but not as CC.
3 people need to get this e-mail... Supervisor, EmpEmail, and EmpEmail2
I have the supervisors e-mail set in the Email Address, EmpEmail is that of the logged in employee, and EmpEmail2 is another staff member.
What I want is an e-mail sent like this...
To: Supervisor
CC: EmpEmail; EmpEmail2
With code...
I get...
To: Supervisor; EmpEmail; EmpEmail2
CC:
With code...
I get...
To: EmpEmail; EmpEmail2
CC:
Is it possible to get...
To: Supervisor
CC: EmpEmail; EmpEmail2
3 people need to get this e-mail... Supervisor, EmpEmail, and EmpEmail2
I have the supervisors e-mail set in the Email Address, EmpEmail is that of the logged in employee, and EmpEmail2 is another staff member.
What I want is an e-mail sent like this...
To: Supervisor
CC: EmpEmail; EmpEmail2
With code...
$rows[0]->extraemail .= ','.$_POST['EmpEmail'].','.$_POST['EmpEmail2'];
I get...
To: Supervisor; EmpEmail; EmpEmail2
CC:
With code...
$rows[0]->extraemail = $_POST['EmpEmail'].','.$_POST['EmpEmail2'];
I get...
To: EmpEmail; EmpEmail2
CC:
Is it possible to get...
To: Supervisor
CC: EmpEmail; EmpEmail2
replace $rows[0]->extraemail with $paramsvalues->ccemail
Success!lightbulb
To overwrite the CC field with multiple address collected on the form:
To append the CC field with multiple address collected on the form
Thanx Max!
To overwrite the CC field with multiple address collected on the form:
<?php
$paramsvalues->ccemail = $_POST['EmpEmail'].','.$_POST['EmpEmail2'];
?>
To append the CC field with multiple address collected on the form
<?php
$paramsvalues->ccemail .= ','.$_POST['EmpEmail'].','.$_POST['EmpEmail2'];
?>
Thanx Max!
gr8
and wow is this ever easier in CF3 Beta2... just add two Dynamic CC boxes, and add one form field to each one😲
exactly
This topic is locked and no more replies can be posted.