예제 #1
0
 /**
  * Send an e-mail message, using Drupal variables and default settings.
  *
  * @see http://pear.php.net/package/Mail/docs
  *
  * @param $message
  *   A message array, as described in hook_mail_alter().
  * @return
  *   TRUE if the mail was successfully accepted, otherwise FALSE.
  */
 public function mail(array $message)
 {
     $php_binary = variable_get(CVWOBASE_D7_PHP_BINARY, FALSE);
     // Send asynchronously, and PHP binary path known
     if ($php_binary && variable_get(CVWOBASE_D7_MAIL_SEND_ASYNC, CVWOBASE_D7_MAIL_SEND_ASYNC_DEFAULT)) {
         DrupalQueue::get(CVWOBASE_MAIL_QUEUE)->createItem($message);
         $execstring = $php_binary . ' ' . DRUPAL_ROOT . '/' . drupal_get_path('module', CVWOBASE_MODULE) . '/cvwobase_d7_email_process.php ' . DRUPAL_ROOT;
         cvwobase_exec($execstring);
         return TRUE;
         // Send inline
     } else {
         $error_queue = new MemoryQueue(CVWOBASE_MAIL_ERROR_QUEUE);
         // name irrelevant
         _cvwobase_d7_send_mail($message, $error_queue);
         if ($error_queue->numberOfItems() > 0) {
             while ($error = $error_queue->claimItem()) {
                 drupal_set_message(t('Unable to send message: PEAR Mail reports error "%error"', array('%error' => $error->data)), 'error');
                 $error_queue->deleteItem($item);
             }
             return FALSE;
         }
         return TRUE;
     }
 }
 function sendQueuedFinalize()
 {
     if ($this->queue_r == null) {
         return false;
     }
     //***$execstring = 'php '.dirname(__FILE__).'/cvwobase_email_process.php '.$this->queue_r->getName();
     $execstring = 'php ' . dirname(__FILE__) . '/cvwobase_email_process.php ' . $this->queue_r->name;
     cvwobase_exec($execstring);
     return true;
 }