XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
xoopsmultimailer.php
Go to the documentation of this file.
1 <?php
29 defined('XOOPS_ROOT_PATH') or die('Restricted access');
33 if (!file_exists($file = XOOPS_ROOT_PATH . '/class/mail/phpmailer/class.phpmailer.php')) {
34  trigger_error('Required File ' . str_replace(XOOPS_ROOT_PATH, '', $file) . ' was not found in file ' . __FILE__ . ' at line ' . __LINE__, E_USER_WARNING);
35  return false;
36 }
37 include_once XOOPS_ROOT_PATH . '/class/mail/phpmailer/class.phpmailer.php';
38 
54 {
61  var $From = '';
62 
69  var $FromName = '';
70 
71  // can be 'smtp', 'sendmail', or 'mail'
86  var $Mailer = 'mail';
87 
97  var $Sendmail = '/usr/sbin/sendmail';
98 
107  var $Host = '';
108 
115  var $SMTPAuth = false;
116 
125  var $Username = '';
126 
135  var $Password = '';
136 
143  function XoopsMultiMailer()
144  {
145  $config_handler = &xoops_gethandler('config');
146  $xoopsMailerConfig = $config_handler->getConfigsByCat(XOOPS_CONF_MAILER);
147  $this->From = $xoopsMailerConfig['from'];
148  if ($this->From == '') {
149  $this->From = $GLOBALS['xoopsConfig']['adminmail'];
150  }
151  $this->Sender = $this->From;
152  if ($xoopsMailerConfig['mailmethod'] == 'smtpauth') {
153  $this->Mailer = 'smtp';
154  $this->SMTPAuth = true;
155  // TODO: change value type of xoopsConfig 'smtphost' from array to text
156  $this->Host = implode(';', $xoopsMailerConfig['smtphost']);
157  $this->Username = $xoopsMailerConfig['smtpuser'];
158  $this->Password = $xoopsMailerConfig['smtppass'];
159  } else {
160  $this->Mailer = $xoopsMailerConfig['mailmethod'];
161  $this->SMTPAuth = false;
162  $this->Sendmail = $xoopsMailerConfig['sendmailpath'];
163  $this->Host = implode(';', $xoopsMailerConfig['smtphost']);
164  }
165  $this->CharSet = strtolower(_CHARSET);
166  $xoopsLanguage = preg_replace('/[^a-zA-Z0-9_-]/', '', $GLOBALS['xoopsConfig']['language']);
167  if (file_exists(XOOPS_ROOT_PATH . '/language/' . $xoopsLanguage . '/phpmailer.php')) {
168  include XOOPS_ROOT_PATH . '/language/' . $xoopsLanguage . '/phpmailer.php';
169  $this->language = $PHPMAILER_LANG;
170  } else {
171  $this->SetLanguage('en', XOOPS_ROOT_PATH . '/class/mail/phpmailer/language/');
172  }
173  $this->PluginDir = XOOPS_ROOT_PATH . '/class/mail/phpmailer/';
174  }
175 
182  function AddrFormat($addr)
183  {
184  if (empty($addr[1])) {
185  $formatted = $addr[0];
186  } else {
187  $formatted = sprintf('%s <%s>', '=?' . $this->CharSet . '?B?' . base64_encode($addr[1]) . '?=', $addr[0]);
188  }
189  return $formatted;
190  }
191 }
192 
193 ?>