Mail not being sent using $mailArray

11 posts by 3 authors in: Forums > CMS Builder
Last Post: June 25, 2013   (RSS)

By Jason - June 25, 2013

Hi Jerry,

One of the issues you are experiencing has to do with how PHP handles strings using single quotes and double quotes differently.  When you use a variable inside a single quote string, the actual variable name just becomes part of the string.  So in the string '$the_subject' the value of the variable is not part of the string.  When you use double quotes, PHP will actually insert the value of the variable into the string.  so the string "$the_subject" will be equal to the value of $the_subject.

In your setup, however, quotes should not be necessary since

'subject'  =>  "$the_subject",

and 

'subject'  =>  $the_subject

will have the exact same value.

So what we need to do is to see if a situation where we know the email will not be sent is producing any errors.  Try this:

$mailArray = array( 
  'to'      => 'gkornbluth@jkwebdesigns.com',
  'from'    => 'exhibition-submissions@artistsofpalmbeachcounty.org',
  'subject' => $the_subject,
  'html'    => $message 
); 
$errors =  sendMessage($mailArray);

if ($errors) { die("Error Sending Email: $errors"); }

Give this a try and let me know if that line produces any errors.

Hope this helps

---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/