Custom field to add user email to mailing list

pgrnycomdir 04 Jan, 2019
I am redoing all of our Chronoforms version 5 to Chronoforms version 6 for a new website. One form is a member registration form. I need to send the users email
to the Mailman software in cpanel to join the mailing list.

I copied the existing php and I admit, I don't have a clue on writing php script. The field I need to send is called "email" and depending on their location, there are nine different mailing lists. This is the php in the custom field in setup that I used, however it does not work. (I have changed the mailing list name and address to protest the innocent!)

<?php
// set a default recipient
$recipient = 'em1';
if ( isset($form->data['recipients']) && $form->data['recipients'] ) {
$recipient = $form->data['recipients'];
}
$emails = array (
'em1' => 'list1-join@website.org',
'em2' => 'list2-join@website.org',
'em3' => 'list3-join@website.org',
'em4' => 'list4-join@website.org',
'em5' => 'list5-join@website.org',
'em6' => 'list6-join@website.org',
'em7' => 'list7-join@website.org',
'em8' => 'list8-join@website.org',
'em9' => 'list9-join@website.org' );
$form->data['email_to_use'] = $emails[$recipient];
?>

Any help would be greatly appreciated.
Best regards and Happy New Year!
Donna
healyhatman 04 Jan, 2019
$form->data is no longer used. You need
$this->data("field name", "default value if field empty")
And for a var call
$this->get("field name", "default value if field empty")
pgrnycomdir 04 Jan, 2019
Thanks healyhatman, I'll give this a try.
pgrnycomdir 05 Jan, 2019
OK, so far I have gotten the form to send information to the correct emails by using a Switch.

But how do I write for the BODY the only information I want sent is the {data:confirm_email} field element?????

Can anyone help with this???

Thank you in advance.
Donna
pgrnycomdir 05 Jan, 2019
1 Likes
Never mind! Boy was I ever over thinking this.

Very simple: Set up a Switch to direct to the correct mailing list. Then set up an email. In the from field {data:field_name}.

Did NOT need to write anything in the body, just who the email was from, in this case the form subscriber!!!

Works fantastically!!!!

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