Skip to content

Commit

Permalink
Adding access to the Swift sendPerformed plugin function
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Baker committed Nov 11, 2016
1 parent c658c75 commit 8eabb73
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Illuminate/Mail/Transport/LogTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null)

$this->logger->debug($this->getMimeEntityString($message));

$this->sendPerformed($message);

return $this->numberOfRecipients($message);
}

Expand Down
2 changes: 2 additions & 0 deletions src/Illuminate/Mail/Transport/MailgunTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null)

$this->client->post($this->url, $options);

$this->sendPerformed($message);

return $this->numberOfRecipients($message);
}

Expand Down
2 changes: 2 additions & 0 deletions src/Illuminate/Mail/Transport/MandrillTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null)

$this->client->post('https://mandrillapp.com/api/1.0/messages/send-raw.json', $options);

$this->sendPerformed($message);

return $this->numberOfRecipients($message);
}

Expand Down
2 changes: 2 additions & 0 deletions src/Illuminate/Mail/Transport/SesTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null)
],
]);

$this->sendPerformed($message);

return $this->numberOfRecipients($message);
}
}
2 changes: 2 additions & 0 deletions src/Illuminate/Mail/Transport/SparkPostTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null)

$this->client->post('https://api.sparkpost.com/api/v1/transmissions', $options);

$this->sendPerformed($message);

return $this->numberOfRecipients($message);
}

Expand Down
18 changes: 18 additions & 0 deletions src/Illuminate/Mail/Transport/Transport.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@ protected function beforeSendPerformed(Swift_Mime_Message $message)
}
}

/**
* Iterate through registered plugins and execute plugins' methods.
*
* @param \Swift_Mime-Message $message
* @return void
*/
protected function sendPerformed(Swift_Mime_Message $message)
{

$event = new Swift_Events_SendEvent($this, $message);

foreach ($this->plugins as $plugin) {
if (method_exists($plugin, 'sendPerformed')) {
$plugin->sendPerformed($event);
}
}
}

/**
* Get the number of recipients.
*
Expand Down

0 comments on commit 8eabb73

Please sign in to comment.