Skip to content

Commit

Permalink
Update the SmtpMailer to return the error that is assigned to the mai…
Browse files Browse the repository at this point in the history
…l object when it fails (#22)
  • Loading branch information
adrhumphreys authored and markguinn committed Mar 21, 2017
1 parent 1a09edc commit 64c5241
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions code/SmtpMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,15 +397,15 @@ public function sendPlain($to, $from, $subject, $plainContent, $attachedFiles =
if ($mail->Send()) {
return array($to, $subject, $plainContent, $customheaders);
} else {
return $this-checkMailError();
return $this-checkMailError($mail);
}
}

/**
* @return bool
* @throws \Exception if he environment is dev
*/
public function checkMailError()
public function checkMailError($mail)
{
if (Director::isDev()) {
throw new \Exception(sprintf(
Expand Down Expand Up @@ -456,7 +456,7 @@ public function sendHTML(
if ($mail->Send()) {
return array($to, $subject, $htmlContent, $customheaders);
} else {
return $this->checkMailError();
return $this->checkMailError($mail);
}
}
}

0 comments on commit 64c5241

Please sign in to comment.