| | |
| | | * @package pxFramework |
| | | * |
| | | */ |
| | | |
| | | |
| | | class ispcmail { |
| | | |
| | | /**#@+ |
| | |
| | | private $user_agent = 'ISPConfig/3 (Mailer Class)'; |
| | | /**#@-*/ |
| | | |
| | | |
| | | |
| | | /** |
| | | * set the mail charset |
| | | */ |
| | |
| | | * |
| | | * @access public |
| | | */ |
| | | |
| | | /** |
| | | * if set to true smtp is used instead of mail() to send emails |
| | | * @see mail |
| | | */ |
| | | private $use_smtp = false; |
| | | |
| | | /** |
| | | * the smtp helo string - use the mail server name here! |
| | | */ |
| | | private $smtp_helo = ''; |
| | | |
| | | /** |
| | | * the smtp server to send mails |
| | | */ |
| | | private $smtp_host = ''; |
| | | |
| | | /** |
| | | * the smtp port |
| | | */ |
| | | private $smtp_port = 25; |
| | | |
| | | /** |
| | | * if the smtp server needs authentication you can set the smtp user here |
| | | */ |
| | | private $smtp_user = ''; |
| | | |
| | | /** |
| | | * if the smtp server needs authentication you can set the smtp password here |
| | | */ |
| | | private $smtp_pass = ''; |
| | | |
| | | /** |
| | | * If you want to use tls/ssl specify it here |
| | | */ |
| | |
| | | * How many mails should be sent via one single smtp connection |
| | | */ |
| | | private $smtp_max_mails = 20; |
| | | |
| | | /** |
| | | * Should the mail be signed |
| | | */ |
| | | private $sign_email = false; |
| | | |
| | | /** |
| | | * The cert and key to use for email signing |
| | | */ |
| | |
| | | private $sign_cert = ''; |
| | | private $sign_bundle = ''; |
| | | private $_is_signed = false; |
| | | |
| | | /** |
| | | * get disposition notification |
| | | */ |
| | |
| | | public function __destruct() { |
| | | $this->finish(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Set option |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** Detect the helo string if none given |
| | | * |
| | | */ |
| | |
| | | if($this->smtp_helo == '') $this->smtp_helo = 'localhost'; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Set options |
| | | * |
| | |
| | | public function setOptions($options) { |
| | | foreach($options as $key => $value) $this->setOption($key, $value); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Read a file's contents |
| | |
| | | |
| | | return $content; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * set smtp connection encryption |
| | |
| | | $this->headers["$header"] = $value; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * get a mail header value |
| | | * |
| | |
| | | if(strtolower($header) == 'bcc') $header = 'Bcc'; |
| | | elseif(strtolower($header) == 'cc') $header = 'Cc'; |
| | | elseif(strtolower($header) == 'from') $header = 'From'; |
| | | return (isset($this->headers["$header"]) ? $this->headers["$header"] : ''); |
| | | return isset($this->headers["$header"]) ? $this->headers["$header"] : ''; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Set email sender |
| | |
| | | $this->setHeader('From', $header); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Set mail subject |
| | | * |
| | |
| | | $this->setHeader('Subject', $subject); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Get current mail subject |
| | | * |
| | |
| | | public function getSubject() { |
| | | return $this->headers['Subject']; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Set mail content |
| | |
| | | $this->text_part = $text; |
| | | $this->html_part = $html; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Read and attach a file |
| | |
| | | $this->attachFile($this->read_File($filename), $display_name); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Attach a file |
| | | * |
| | |
| | | ); |
| | | $this->attachments[] = $attachment; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * @access private |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Function to sign an email body |
| | | */ |
| | |
| | | return '=' . strtoupper(dechex(ord($matches[1]))); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Function to encode a header if necessary |
| | | * according to RFC2047 |
| | |
| | | |
| | | return $input; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Function to encode the subject if necessary |
| | |
| | | |
| | | return $input; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * @access private |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * @access private |
| | | */ |
| | |
| | | $response = @fgets($this->_smtp_conn, 515); |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Send the mail to one or more recipients |
| | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Close mail connections |
| | | * |
| | |
| | | |
| | | return; |
| | | } |
| | | |
| | | } |
| | | |
| | | ?> |