2
0
forked from Wavyzz/dolibarr

swiftmailer

This commit is contained in:
Frédéric FRANCE
2018-01-21 15:55:56 +01:00
parent 3a8ceb130f
commit a34b99f3ec
191 changed files with 5164 additions and 4074 deletions

View File

@@ -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;
}
}