X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2Fmail%2FMailer.class.php;h=30f0ffb64b20c8b249d8a1b437bb1b83de7445ee;hb=75a1eedb8977b8f2db459128bab9aaf367e3b58b;hp=6b301be1604382ba81484c3a161c268a322e0760;hpb=fa157c9419df82b1cab041e771dab947a174c652;p=timetracker.git diff --git a/WEB-INF/lib/mail/Mailer.class.php b/WEB-INF/lib/mail/Mailer.class.php index 6b301be1..30f0ffb6 100644 --- a/WEB-INF/lib/mail/Mailer.class.php +++ b/WEB-INF/lib/mail/Mailer.class.php @@ -33,12 +33,13 @@ class Mailer { var $mSender; var $mReceiver; var $mReceiverCC; + var $mReceiverBCC; function __construct($type='mail') { $this->mMailMode = $type; } - function setSendType($value) { + function setMailMode($value) { $this->mMailMode = $value; } @@ -58,6 +59,10 @@ class Mailer { $this->mReceiverCC = $value; } + function setReceiverBCC($value) { + $this->mReceiverBCC = $value; + } + function setSender($value) { $this->mSender = $value; } @@ -68,6 +73,7 @@ class Mailer { $headers = array('From' => $this->mSender, 'To' => $this->mReceiver); if (isset($this->mReceiverCC)) $headers = array_merge($headers, array('CC' => $this->mReceiverCC)); + if (isset($this->mReceiverBCC)) $headers = array_merge($headers, array('BCC' => $this->mReceiverBCC)); $headers = array_merge($headers, array( 'Subject' => $subject, 'MIME-Version' => '1.0', @@ -84,18 +90,22 @@ class Mailer { break; case 'smtp': - // Mail_smtp does not do CC -> recipients conversion + // Mail_smtp does not do CC or BCC -> recipients conversion. if (!empty($this->mReceiverCC)) { // make exactly one space after a comma $recipients .= ', ' . preg_replace('/,[[:space:]]+/', ', ', $this->mReceiverCC); } + if (!empty($this->mReceiverBCC)) { + // make exactly one space after a comma + $recipients .= ', ' . preg_replace('/,[[:space:]]+/', ', ', $this->mReceiverBCC); + } $host = defined('MAIL_SMTP_HOST') ? MAIL_SMTP_HOST : 'localhost'; $port = defined('MAIL_SMTP_PORT') ? MAIL_SMTP_PORT : '25'; $username = defined('MAIL_SMTP_USER') ? MAIL_SMTP_USER : null; $password = defined('MAIL_SMTP_PASSWORD') ? MAIL_SMTP_PASSWORD : null; - $auth = (defined('MAIL_SMTP_AUTH') && isTrue(MAIL_SMTP_AUTH)) ? true : false; - $debug = (defined('MAIL_SMTP_DEBUG') && isTrue(MAIL_SMTP_DEBUG)) ? true : false; + $auth = isTrue('MAIL_SMTP_AUTH'); + $debug = isTrue('MAIL_SMTP_DEBUG'); $mail = Mail::factory('smtp', array ('host' => $host, 'port' => $port, @@ -106,7 +116,7 @@ class Mailer { break; } - if (defined('MAIL_SMTP_DEBUG') && isTrue(MAIL_SMTP_DEBUG)) + if (isTrue('MAIL_SMTP_DEBUG')) PEAR::setErrorHandling(PEAR_ERROR_PRINT); $res = $mail->send($recipients, $headers, $data);