Example #1
0
	function __construct($user = null, $from=null)
	{
		global $prefs, $tikilib;

		parent::htmlMimeMail();
		$this->charset = !$user ? $prefs['default_mail_charset'] : $tikilib->get_user_preference($user, 'mailCharset', 'utf-8');
		$this->setTextCharset($this->charset);
		$this->setHtmlCharset($this->charset);
		$this->setHeadCharset($this->charset);
		if (isset($prefs['mail_crlf'])) {
			$this->setCrlf($prefs['mail_crlf'] == "LF"? "\n": "\r\n");
		}
		if ($prefs['zend_mail_handler'] == 'smtp') {
			if ($prefs['zend_mail_smtp_auth'] == 'login') {
				$this->setSMTPParams(
								$prefs['zend_mail_smtp_server'], 
								$prefs['zend_mail_smtp_port'], 
								$prefs['zend_mail_smtp_helo'], 
								true, 
								$prefs['zend_mail_smtp_user'], 
								$prefs['zend_mail_smtp_pass'], 
								$prefs['zend_mail_smtp_security']
				);
			} else {
				$this->setSMTPParams(
								$prefs['zend_mail_smtp_server'], 
								$prefs['zend_mail_smtp_port'], 
								$prefs['zend_mail_smtp_helo'], 
								false, 
								null, 
								null,
								$prefs['zend_mail_smtp_security']
				);
			}
		}
		if (empty($from)) {
			$from = $prefs['sender_email'];
		}
		$this->setFrom($from);
		if (!@ini_get('safe_mode')) {
			$this->setReturnPath($from); // in safe-mode, return-path must then be configured at the server level
		}
		$this->setHeader("Return-Path", $from); // just in case, mainly will not work as usually the server rewrites the envelop
		$this->setHeader("Reply-To", $from);
	}
 function TikiMail($user = null)
 {
     global $prefs, $tikilib;
     parent::htmlMimeMail();
     $this->charset = !$user ? $prefs['default_mail_charset'] : $tikilib->get_user_preference($user, 'mailCharset', 'utf-8');
     $this->setTextCharset($this->charset);
     $this->setHtmlCharset($this->charset);
     $this->setHeadCharset($this->charset);
     if (isset($prefs['mail_crlf'])) {
         $this->setCrlf($prefs['mail_crlf'] == "LF" ? "\n" : "\r\n");
     }
     $this->setFrom($prefs['sender_email']);
     if (!@ini_get('safe_mode')) {
         $this->setReturnPath($prefs['sender_email']);
     }
     // in safe-mode, return-path must then be configured at the server level
     $this->setHeader("Return-Path", "<" . $prefs['sender_email'] . ">");
     // just in case, mainly will not work as usually the server rewrites the envelop
     $this->setHeader("Reply-To", "<" . $prefs['sender_email'] . ">");
 }