Missing Env. Variables when called by AT Scheduler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We regularly send out massive mail blasts to our customers. Recently several mail blasts failed to transmit. After a serious amount of research we found the snippet of code below to be the place where it was breaking down. The issue it seems is that the Environment Variables HOST and SERVER_NAME are sometimes not returning true when executed from the Linux AT scheduler. (using atq commands). doing a php -i from the command line returns the correct values, as does putting in a php info command at the top of the script and opening it from a browser.

Does anyone have any clues about why a script called from the AT scheduler would be unable to detect what server it is on and behave appropriately?

function send_mail($subject, $subject_name, $from, $email, $customer_name, $html_message, $text_message, $customer_id=0) { if($_SERVER['HOST'] == 'domain.com' || $_SERVER['SERVER_NAME']=='customer.domain.com') {
               global $mail;
               if(!is_object($mail)) {
                       $mail = create_mail();
               }
       } else {
// If on staging server don't send emails to any address outside company
               if(!stristr($email, '@domain.com')) return true;
               $mail = Mail::factory('mail');



Thanks,

Joel

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux