forked from Wavyzz/dolibarr
swiftmailer
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
class Swift_Mailer
|
||||
{
|
||||
/** The Transport used to send messages */
|
||||
private $_transport;
|
||||
private $transport;
|
||||
|
||||
/**
|
||||
* Create a new Mailer using $transport for delivery.
|
||||
@@ -25,19 +25,7 @@ class Swift_Mailer
|
||||
*/
|
||||
public function __construct(Swift_Transport $transport)
|
||||
{
|
||||
$this->_transport = $transport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Mailer instance.
|
||||
*
|
||||
* @param Swift_Transport $transport
|
||||
*
|
||||
* @return Swift_Mailer
|
||||
*/
|
||||
public static function newInstance(Swift_Transport $transport)
|
||||
{
|
||||
return new self($transport);
|
||||
$this->transport = $transport;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,23 +54,23 @@ class Swift_Mailer
|
||||
* The return value is the number of recipients who were accepted for
|
||||
* delivery.
|
||||
*
|
||||
* @param Swift_Mime_Message $message
|
||||
* @param array $failedRecipients An array of failures by-reference
|
||||
* @param Swift_Mime_SimpleMessage $message
|
||||
* @param array $failedRecipients An array of failures by-reference
|
||||
*
|
||||
* @return int
|
||||
* @return int The number of successful recipients. Can be 0 which indicates failure
|
||||
*/
|
||||
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
|
||||
public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
|
||||
{
|
||||
$failedRecipients = (array) $failedRecipients;
|
||||
|
||||
if (!$this->_transport->isStarted()) {
|
||||
$this->_transport->start();
|
||||
if (!$this->transport->isStarted()) {
|
||||
$this->transport->start();
|
||||
}
|
||||
|
||||
$sent = 0;
|
||||
|
||||
try {
|
||||
$sent = $this->_transport->send($message, $failedRecipients);
|
||||
$sent = $this->transport->send($message, $failedRecipients);
|
||||
} catch (Swift_RfcComplianceException $e) {
|
||||
foreach ($message->getTo() as $address => $name) {
|
||||
$failedRecipients[] = $address;
|
||||
@@ -99,7 +87,7 @@ class Swift_Mailer
|
||||
*/
|
||||
public function registerPlugin(Swift_Events_EventListener $plugin)
|
||||
{
|
||||
$this->_transport->registerPlugin($plugin);
|
||||
$this->transport->registerPlugin($plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,6 +97,6 @@ class Swift_Mailer
|
||||
*/
|
||||
public function getTransport()
|
||||
{
|
||||
return $this->_transport;
|
||||
return $this->transport;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user