Chronoforms 2.5
Is there a way to re-email the 'saved form data'? Maybe with a custom script?
We have been having some email problems and need to resend the data formatted by the email template so the office can file it in their usual manner.
Can i possibly pull the entries from the database and run them through the script that creates the email template?
Is there a way to re-email the 'saved form data'? Maybe with a custom script?
We have been having some email problems and need to resend the data formatted by the email template so the office can file it in their usual manner.
Can i possibly pull the entries from the database and run them through the script that creates the email template?
Hi wizdum,
yes you can do this, but you need to write SQL to get the form data stored and loop through every one and apply the template code and send an email, the idea is easy but it needs the code written well!
look at the autogenerated code for the table name and search here for SELECT to see how you can write a SQL select statement and loop results and send the email with Jutility::sendMail
Max
yes you can do this, but you need to write SQL to get the form data stored and loop through every one and apply the template code and send an email, the idea is easy but it needs the code written well!
look at the autogenerated code for the table name and search here for SELECT to see how you can write a SQL select statement and loop results and send the email with Jutility::sendMail
Max
No problems!
Hello,
I need to be able to resend emails with previously saved results as well.
Does anybody have the script already?
Thanks!
I need to be able to resend emails with previously saved results as well.
Does anybody have the script already?
Thanks!
Hello,
You can do this by using a "DB Record loader" to load the data then use an email action, pay attention to the structure of the data in the $form->data array as this affects how you can write the strings in the email.
If data is loaded under a model id then you need to use: {model.field_name}
Regards,
Max
You can do this by using a "DB Record loader" to load the data then use an email action, pay attention to the structure of the data in the $form->data array as this affects how you can write the strings in the email.
If data is loaded under a model id then you need to use: {model.field_name}
Regards,
Max
Hello Max,
Thanks for your prompt reply and a great suggestion. I was able to get the "DB Record Loader" to work with Data Load Type = First Record but not All of them, which is what I need...
Am I missing something?
Thanks a lot!
Thanks for your prompt reply and a great suggestion. I was able to get the "DB Record Loader" to work with Data Load Type = First Record but not All of them, which is what I need...
Am I missing something?
Thanks a lot!
Hi Sloan,
Thank you!
I forgot to mention that I am using the DB Multi Record Loader action.
And I know I can loop the records through PHP:
Yes, I do need to send one email per record... So how do I put my email action inside the loop??
THanks for your help!
Thank you!
I forgot to mention that I am using the DB Multi Record Loader action.
And I know I can loop the records through PHP:
<?php
foreach($form->data['eventvolunteers'] as $volunteer){
echo $volunteer['fname']." ".$volunteer['lname'];
echo '<br />';
} ?>
Yes, I do need to send one email per record... So how do I put my email action inside the loop??
THanks for your help!
Hi,
If each record has an email address you need to use then just loop through all records and store all addresses in an array, then implode it and use that value as the dynamic "TO" or "BCC":
then use "dto" in the dynamic to or bcc, if you use bcc then you must have at least 1 static "to" address, I think so.
Regards,
Max
If each record has an email address you need to use then just loop through all records and store all addresses in an array, then implode it and use that value as the dynamic "TO" or "BCC":
//your array of address is $emails
$form->data['dto'] = implode(",", $emails);
then use "dto" in the dynamic to or bcc, if you use bcc then you must have at least 1 static "to" address, I think so.
Regards,
Max
Hi,
Thanks for the suggestion, but I actually need to send out dynamic emails (about 65 of them) to one recipient...
Thanks for the suggestion, but I actually need to send out dynamic emails (about 65 of them) to one recipient...
Hi Dan,
Here's the main mailer code. This covers several different Joomla! versions, I think that in fact the 1.6-2.5 code would also work on Joomla! 3:
Bob
Here's the main mailer code. This covers several different Joomla! versions, I think that in fact the 1.6-2.5 code would also work on Joomla! 3:
if ( $jversion->RELEASE <= 1.5) {
if ( !count( $replyto_name ) ) {
$replyto_name = '';
}
$email_sent = JUtility::sendMail( $from_email, $from_name, $recipients, $subject, $email_body, $sendas, $cc_emails, $bcc_emails, $email_attachments, $replyto_email, $replyto_name );
} elseif ( $jversion->RELEASE > 1.5 && $jversion->RELEASE < 3 ) {
$mail =& JFactory::getMailer();
$email_sent = $mail->sendMail( $from_email, $from_name, $recipients, $subject, $email_body, $sendas, $cc_emails, $bcc_emails, $email_attachments, $replyto_email, $replyto_name );
} elseif ( $jversion->RELEASE > 2 ) {
$mail =& JMail::getInstance();
$mail->setSender(array( $from_email, $from_name ));
$mail->addRecipient($recipients);
$mail->setSubject($subject);
$mail->setBody($email_body);
$mail->isHTML((bool) $sendas == 'html' );
$mail->Encoding = 'base64';
$mail->addAttachment($email_attachments);
$mail->addCC($cc_emails);
$mail->addBCC($bcc_emails);
$mail->addReplyTo(array($replyto_email, $replyto_name));
$email_sent = $mail->Send();
}
Bob
This topic is locked and no more replies can be posted.