Send Email to Multiple Recipients

rankwork 15 Nov, 2008
Hi,

I have been using chronoforms V3.0 stable and I can say that its a great product ! Keep it up ! 😀

I am making a tell a friend script and I would like to know how I can use the Dynamic Email option or any other alternative in the chronoforms V3.0 stable in order to send an email to multiple recipients that the user has entered in the form i.e. it won't be using predefined 'to email' but it should send emails to the email addresses entered into the form by the user.

Kind Regards
Max_admin 16 Nov, 2008
Hi rankwork,

so your form got 2 fields to capture the emails addresses from the user ? what are the 2 fields names ? lets assume they are called : emailfield1 and emailfield2, so simply add 2 dynamic TO fields to your email and at one of them write emailfield1 which is the same as the field name, and at the other write emailfield2

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rankwork 21 Nov, 2008
Thanks Max, I did that and it works fine.

One problem, I have 3 email fields where the user can enter any of the 3 if he so chooses, meaning he could either enter one two or three email addresses. The thing is if enter one email when test running, it generates the error PHPMAILER_RECIPIENTS_FAILED, if I enter two emails I get SMTP Error! The following recipients failed: but when I enter all 3 fields it works fine.

Is there a possibility of adding an 'OR' somewhere ?
Max_admin 21 Nov, 2008
Hi rankwork,

try this PHP code in the onsubmit before email box then:


$toemails = array();
if(JRequest::getVar('emailfield1')){
$toemails[] = JRequest::getVar('emailfield1');
}
if(JRequest::getVar('emailfield2')){
$toemails[] = JRequest::getVar('emailfield2');
}
if(JRequest::getVar('emailfield3')){
$toemails[] = JRequest::getVar('emailfield3');
}
$emails[0]->to  = implode("," , $toemails);


Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rankwork 22 Nov, 2008
This did not work. It seems like the script is reading all the dynamic to emails as required hence when one or two are not there then it generates an error as it doesn't read the blank email parameters correctly.

Hey Wait....
Should I change emailfield1 etc to the actual names of my email fields ??
rankwork 22 Nov, 2008
I just tried it, still fails.
Max_admin 22 Nov, 2008
yes you should change that to the emails fields names at your form, I assume you have only 1 email setup, this will work for the first email at the list!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rankwork 24 Nov, 2008
This is what I have posted in the on submit code before sending email :

<?

$toemails = array();
if(JRequest::getVar('text_5')){
$toemails[] = JRequest::getVar('text_5');
}
if(JRequest::getVar('text_3')){
$toemails[] = JRequest::getVar('text_3');
}
if(JRequest::getVar('text_8')){
$toemails[] = JRequest::getVar('text_8');
}
$emails[0]->to = implode("," , $toemails);
?>

I still get the same errors. Is there anything else I need to change ?
Max_admin 24 Nov, 2008
try to use <?php instead of <?

how many emails do you have in the "setup emails" tab ?

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rankwork 27 Nov, 2008
I have 3 to emails and 1 from email.
Max_admin 27 Nov, 2008
can you show me a screenshot of your emails tab and you can hide any private data!

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.

VPS & Email Hosting 20% discount
hostinger