Mail not being sent using $mailArray
11 posts by 3 authors in: Forums > CMS Builder
Last Post: June 25, 2013 (RSS)
By gkornbluth - June 22, 2013
Hi All,
I’ve used similar code before but this time I can’t get it to work and I've gone as far as I can, so it’s time to ask for help.
The problem seems to center around the use of single and double quotes around the $the_subject and $message variables in the following $mailArray code:$the_subject = "Your submission to the $where Exhibition has been Juried";
$mailArray = array(
'to' => 'gkornbluth@jkwebdesigns.com',
'from' => 'exhibition-submissions@artistsofpalmbeachcounty.org',
'subject' => $the_subject,
'html' => $message
);
$errors = sendMessage($mailArray);
// delay execution by .2 sec before next loop
usleep(200000);
// reset max_execution_time to 30 sec before next loop
set_time_limit(30);
?>
When there are single quotes around the $the_subject and double quotes around $message, the email is sent. The body of the email is the correct HTML, but the subject of the email displays as $the_subject.
When I reverse the single and double quotes, the subject of the email displays correctly, but the body of the email displays as $message.
Any other combination of single, double or no quotes results in the email not being sent.
I've attached the complete code just in case it's helpful.
Hope someone has some time to look at this.
Thanks,
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
By nmsinc - June 23, 2013
Hi Jerry
Try the following:
$the_subject = "Your submission to the $where Exhibition has been Juried";
$mailArray = array(
'to' => 'gkornbluth@jkwebdesigns.com',
'from' => 'exhibition-submissions@artistsofpalmbeachcounty.org',
'subject' => $the_subject,
'html' => $message,
),
));
$errors = sendMessage($mailArray);
// delay execution by .2 sec before next loop
usleep(200000);
// reset max_execution_time to 30 sec before next loop
set_time_limit(30);
?>
By gkornbluth - June 23, 2013
Thanks, I'll give ti a try.
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
By gkornbluth - June 23, 2013
Hi NMSINC,
Good idea, but when I try to insert the
),
));
In place of the
};
I get an coding error in Dreamweaver.
Maybe I'm not understanding your suggestion correctly.
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
By nmsinc - June 24, 2013
Hi Jerry,
I code using MS Expression and I have never received this error and I have used this same set of code many times with email sets with no problem. Will Dreamweaver allow you to set and test this code without changing it for you?
Thanks
NMSINC
By nmsinc - June 24, 2013
One more idea - I also use the following mail error handle just after the
));
$mailErrors = sendMessage($emailHeaders);
if ($mailErrors) {die("Mail Error: $errors"); }
}
By gkornbluth - June 24, 2013
I think that the error is because you had more "(" in your code than I do and every closing one needs a corresponding opening one
Jerry
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
By gkornbluth - June 24, 2013 - edited: June 24, 2013
Have you got a working page that uses variables and the mailArray that you'd be willing to share?
Then I might be able to do some reverse engineering and see if there's another issue in my code
Jerry
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
By nmsinc - June 24, 2013
Here you go!
$emailTemplate = "emails/email.php";
$emailHeaders = emailTemplate_load(array(
'template' => websiteLogin_pluginDir() . "/$emailTemplate",
'subject' => '', // set in template
'from' => '', // set in template
'to' => $mail_ind_adj['email'],
'placeholders' => array(
'fullname' => $mail_ind_adj['fullname'],
'address' => $claim_num['address'],
'city' => $claim_num['city'],
'state' => $claim_num['state'],
'zip' => $claim_num['zip'],
),
));
$mailErrors = sendMessage($emailHeaders);
if ($mailErrors) {die("Mail Error: $errors"); }
By gkornbluth - June 24, 2013
Hi NMSINC,
Thanks for all your efforts.
You seem to be using the email template to send your emails.
I'm not, and I still don't know how to resolve the initial issues I have sending emails with my existing page.
Any one have thoughts?
Thanks again,
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php