本文整理匯總了PHP中Swift_SmtpTransport::isStarted方法的典型用法代碼示例。如果您正苦於以下問題:PHP Swift_SmtpTransport::isStarted方法的具體用法?PHP Swift_SmtpTransport::isStarted怎麽用?PHP Swift_SmtpTransport::isStarted使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Swift_SmtpTransport
的用法示例。
在下文中一共展示了Swift_SmtpTransport::isStarted方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: connect
/**
* Connect to Mail server
*
* @param array $config
* @return boolean
*/
public function connect(array $config)
{
// Create the Transport
$this->mailer = new \Swift_SmtpTransport($config['server'], $config['port'], sizeof($config['secure']) > 0 ? $config['secure'] : null);
$this->mailer->setUsername($config['username']);
$this->mailer->setPassword($config['password']);
$this->mailer->start();
return $this->mailer->isStarted();
}
示例2: execute
public function execute(Request $request, $function)
{
switch ($function) {
case 'verify-smtp':
$smtp = new \Swift_SmtpTransport($request->input('smtp-server'), $request->input('smtp-port'), $request->input('smtp-ssl'));
$smtp->setUsername($request->input('smtp-username'));
$smtp->setPassword($request->input('smtp-password'));
$smtp->start();
$this->ajax_result['errno'] = 0;
$this->ajax_result['html'] = 'OK';
$this->ajax_result['smtp'] = $smtp->isStarted();
// $this -> ajax_result['errno'] = time() % 2;
// $this -> ajax_result['errmsg'] = 'chujnia jakas sie wydazyla';
// $this -> ajax_result['html'] = 'chujnia jakas sie wydazyla';
break;
}
echo json_encode($this->ajax_result);
}
示例3: connect
/**
* Connect to Mail server
*
* @param array $config
* @throws \RuntimeException
* @return \Swift_SmtpTransport
*/
public function connect(array $config)
{
// save config
$this->config = $config;
try {
if (!$this->connect) {
$this->connect = new \Swift_SmtpTransport($config['server'], $config['port'], $config['socket']);
$this->connect->setUsername($config['username']);
$this->connect->setPassword($config['password']);
$this->connect->start();
}
if ($this->connect->isStarted() === false) {
throw new MailException('Mail connection failed! Check configurations');
}
return $this;
} catch (\Exception $e) {
throw new MailException($e->getMessage());
}
}