mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-28 07:39:55 +09:00
Standardize config field names, and make drivers declare which fields they require
This commit is contained in:
parent
4d1ada5f28
commit
10309e5811
6 changed files with 99 additions and 5 deletions
|
|
@ -12,9 +12,9 @@ class SMTP extends Base implements \Rhymix\Framework\Drivers\MailInterface
|
|||
*/
|
||||
protected function __construct(array $config)
|
||||
{
|
||||
$transport = \Swift_SmtpTransport::newInstance($config['host'], $config['port'], $config['secure']);
|
||||
$transport->setUsername($config['user']);
|
||||
$transport->setPassword($config['pass']);
|
||||
$transport = \Swift_SmtpTransport::newInstance($config['smtp_host'], $config['smtp_port'], $config['smtp_security']);
|
||||
$transport->setUsername($config['smtp_user']);
|
||||
$transport->setPassword($config['smtp_pass']);
|
||||
$local_domain = $transport->getLocalDomain();
|
||||
if (preg_match('/^\*\.(.+)$/', $local_domain, $matches))
|
||||
{
|
||||
|
|
@ -23,6 +23,16 @@ class SMTP extends Base implements \Rhymix\Framework\Drivers\MailInterface
|
|||
$this->mailer = \Swift_Mailer::newInstance($transport);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of configuration fields required by this mail driver.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getRequiredConfig()
|
||||
{
|
||||
return array('smtp_host', 'smtp_port', 'smtp_security', 'smtp_user', 'smtp_pass');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current mail driver is supported on this server.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue