Allow injecting an SMTP instance

This commit is contained in:
Marcus Bointon 2017-05-29 14:07:11 +02:00
parent 262dc4997a
commit cd2f977899
No known key found for this signature in database
GPG Key ID: DE31CD6EB646AA24
2 changed files with 15 additions and 1 deletions

View File

@ -55,6 +55,7 @@ This is a major update that breaks backwards compatibility.
* Now checks for invalid host strings when sending via SMTP.
* Include timestamps in HTML-format debug output
* More reliable folding of message headers
* Inject your own SMTP implementation via `setSMTPInstance()` instead of having to subclass and override `getSMTPInstance()`.
## Version 5.2.23 (March 15th 2017)
* Improve trapping of TLS errors during connection so that they don't cause warnings, and are reported better in debug output

View File

@ -1587,7 +1587,8 @@ class PHPMailer
/**
* Get an instance to use for SMTP operations.
* Override this function to load your own SMTP implementation
* Override this function to load your own SMTP implementation,
* or set one with setSMTPInstance.
*
* @return SMTP
*/
@ -1599,6 +1600,18 @@ class PHPMailer
return $this->smtp;
}
/**
* Provide an instance to use for SMTP operations.
*
* @param SMTP $smtp
* @return SMTP
*/
public function setSMTPInstance(SMTP $smtp)
{
$this->smtp = $smtp;
return $this->smtp;
}
/**
* Send mail via SMTP.
* Returns false if there is a bad MAIL FROM, RCPT, or DATA input.