mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-25 14:19:58 +09:00
Reorganize mail driver class structure and add SES driver
This commit is contained in:
parent
a12722ad79
commit
0420361349
8 changed files with 189 additions and 90 deletions
|
|
@ -5,13 +5,8 @@ namespace Rhymix\Framework\Drivers\Mail;
|
|||
/**
|
||||
* The SMTP mail driver.
|
||||
*/
|
||||
class SMTP implements \Rhymix\Framework\Drivers\MailInterface
|
||||
class SMTP extends Base implements \Rhymix\Framework\Drivers\MailInterface
|
||||
{
|
||||
/**
|
||||
* The mailer instance is stored here.
|
||||
*/
|
||||
protected $_mailer = null;
|
||||
|
||||
/**
|
||||
* Direct invocation of the constructor is not permitted.
|
||||
*/
|
||||
|
|
@ -28,17 +23,6 @@ class SMTP implements \Rhymix\Framework\Drivers\MailInterface
|
|||
$this->mailer = \Swift_Mailer::newInstance($transport);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance of the current mail driver, using the given settings.
|
||||
*
|
||||
* @param array $config
|
||||
* @return void
|
||||
*/
|
||||
public static function getInstance(array $config)
|
||||
{
|
||||
return new self($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current mail driver is supported on this server.
|
||||
*
|
||||
|
|
@ -61,7 +45,16 @@ class SMTP implements \Rhymix\Framework\Drivers\MailInterface
|
|||
*/
|
||||
public function send(\Rhymix\Framework\Mail $message)
|
||||
{
|
||||
$result = $this->mailer->send($message->message, $errors);
|
||||
try
|
||||
{
|
||||
$result = $this->mailer->send($message->message, $errors);
|
||||
}
|
||||
catch(\Exception $e)
|
||||
{
|
||||
$message->errors[] = $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($errors as $error)
|
||||
{
|
||||
$message->errors[] = $error;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue