51 'host' =>
'localhost',
77 $this->_params[
'host'] = $host;
87 return $this->_params[
'host'];
96 $this->_params[
'port'] = (int) $port;
106 return $this->_params[
'port'];
115 $this->_params[
'timeout'] = (int) $timeout;
125 return $this->_params[
'timeout'];
134 $this->_params[
'protocol'] = $enc;
144 return $this->_params[
'protocol'];
154 foreach ($handlers as $handler)
156 $assoc[$handler->getHandledKeyword()] = $handler;
158 uasort($assoc, array($this,
'_sortHandlers'));
159 $this->_handlers = $assoc;
170 return array_values($this->_handlers);
184 $failures = (array) $failures;
189 $response = $handler->onCommand(
190 $this, $command, $codes, $failures, $stopSignal
197 return parent::executeCommand($command, $codes, $failures);
205 foreach ($this->_handlers as $handler)
207 if (in_array(strtolower($method),
208 array_map(
'strtolower', (array) $handler->exposeMixinMethods())
211 $return = call_user_func_array(array($handler, $method), $args);
213 if (is_null($return) && substr($method, 0, 3) ==
'set')
223 trigger_error(
'Call to undefined method ' . $method, E_USER_ERROR);
240 sprintf(
"EHLO %s\r\n", $this->_domain), array(250)
245 return parent::_doHeloCommand();
252 $handler->afterEhlo($this);
261 foreach ($handlers as $handler)
263 $params = array_merge($params, (array) $handler->getMailParams());
265 $paramStr = !empty($params) ?
' ' . implode(
' ', $params) :
'';
267 sprintf(
"MAIL FROM: <%s>%s\r\n", $address, $paramStr), array(250)
276 foreach ($handlers as $handler)
278 $params = array_merge($params, (array) $handler->getRcptParams());
280 $paramStr = !empty($params) ?
' ' . implode(
' ', $params) :
'';
282 sprintf(
"RCPT TO: <%s>%s\r\n", $address, $paramStr), array(250, 251, 252)
291 $capabilities = array();
292 $ehloResponse = trim($ehloResponse);
293 $lines = explode(
"\r\n", $ehloResponse);
295 foreach ($lines as $line)
297 if (preg_match(
'/^[0-9]{3}[ -]([A-Z0-9-]+)((?:[ =].*)?)$/Di', $line, $matches))
299 $keyword = strtoupper($matches[1]);
300 $paramStr = strtoupper(ltrim($matches[2],
' ='));
301 $params = !empty($paramStr) ? explode(
' ', $paramStr) : array();
302 $capabilities[$keyword] = $params;
305 return $capabilities;
311 foreach ($this->_handlers as $keyword => $handler)
313 if (array_key_exists($keyword, $this->_capabilities))
315 $handler->setKeywordParams($this->_capabilities[$keyword]);
324 foreach ($this->_handlers as $keyword => $handler)
326 if (array_key_exists($keyword, $this->_capabilities))
328 $handlers[] = $handler;
337 return $a->getPriorityOver($b->getHandledKeyword());