Beispiel #1
0
 function Send()
 {
     Debug::Text('Attempting to send email To: ' . $this->getTo(), __FILE__, __LINE__, __METHOD__, 10);
     if ($this->getTo() == FALSE) {
         Debug::Text('To Address invalid...', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     if ($this->getBody() == FALSE) {
         Debug::Text('Body invalid...', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     Debug::Text('Sending Email To: ' . $this->getTo() . ' Body Size: ' . strlen($this->getBody()) . ' Method: ' . $this->getDeliveryMethod(), __FILE__, __LINE__, __METHOD__, 10);
     if (PRODUCTION == FALSE) {
         Debug::Text('Not in production mode, not sending emails...', __FILE__, __LINE__, __METHOD__, 10);
         //$to = 'root@localhost';
         return FALSE;
     }
     if (DEMO_MODE == TRUE) {
         Debug::Text('In DEMO mode, not sending emails...', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     switch ($this->getDeliveryMethod()) {
         case 'smtp':
         case 'mail':
             $send_retval = $this->getMailObject()->send($this->getTo(), $this->getMIMEHeaders(), $this->getBody());
             if (PEAR::isError($send_retval)) {
                 Debug::Text('Send Email Failed... Error: ' . $send_retval->getMessage(), __FILE__, __LINE__, __METHOD__, 10);
                 $send_retval = FALSE;
             }
             break;
         case 'soap':
             $ttsc = new TimeTrexSoapClient();
             $send_retval = $ttsc->sendEmail($this->getTo(), $this->getMIMEHeaders(), $this->getBody());
             break;
     }
     if ($send_retval == TRUE) {
         return TRUE;
     }
     Debug::Arr($send_retval, 'Send Email Failed!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }
 function Send()
 {
     Debug::Text('Attempting to send email To: ' . $this->getTo(), __FILE__, __LINE__, __METHOD__, 10);
     if ($this->getTo() == FALSE) {
         Debug::Text('To Address invalid...', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     if ($this->getBody() == FALSE) {
         Debug::Text('Body invalid...', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     if (PRODUCTION == FALSE) {
         Debug::Text('Not in production mode, not sending emails...', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     if (DEMO_MODE == TRUE) {
         Debug::Text('In DEMO mode, not sending emails...', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     /*
     		if ( PRODUCTION == FALSE ) {
     			$to = 'root@localhost';
     		}
     */
     Debug::Text('Sending Email To: ' . $this->getTo() . ' Body Size: ' . strlen($this->getBody()) . ' Method: ' . $this->getDeliveryMethod(), __FILE__, __LINE__, __METHOD__, 10);
     //For some reason the EOL defaults to \r\n, which seems to screw with Amavis
     if (!defined('MAIL_MIMEPART_CRLF')) {
         define('MAIL_MIMEPART_CRLF', "\n");
     }
     switch ($this->getDeliveryMethod()) {
         case 'smtp':
         case 'mail':
             $send_retval = $this->getMailObject()->send($this->getTo(), $this->getMIMEHeaders(), $this->getBody());
             break;
         case 'soap':
             $ttsc = new TimeTrexSoapClient();
             $send_retval = $ttsc->sendEmail($this->getTo(), $this->getMIMEHeaders(), $this->getBody());
             break;
     }
     if ($send_retval == TRUE) {
         return TRUE;
     }
     Debug::Arr($send_retval, 'Send Email Failed!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }