Standardize config field names, and make drivers declare which fields they require

This commit is contained in:
Kijin Sung 2016-05-10 15:58:26 +09:00
parent 4d1ada5f28
commit 10309e5811
6 changed files with 99 additions and 5 deletions

View file

@ -17,12 +17,32 @@ class SES extends Base implements \Rhymix\Framework\Drivers\MailInterface
*/
protected function __construct(array $config)
{
$transport = \Swift_AWSTransport::newInstance($config['user'], $config['pass']);
$transport = \Swift_AWSTransport::newInstance($config['api_user'], $config['api_pass']);
$transport->setDebug(array($this, 'debugCallback'));
$transport->setEndpoint('https://email.' . strtolower($config['type']) . '.amazonaws.com/');
$transport->setEndpoint('https://email.' . strtolower($config['api_type']) . '.amazonaws.com/');
$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('api_user', 'api_pass', 'api_type');
}
/**
* Get the list of API types supported by this mail driver.
*
* @return array
*/
public static function getAPITypes()
{
return array('us-east-1', 'us-west-2', 'eu-west-1');
}
/**
* Check if the current mail driver is supported on this server.
*