-
-
Save fhferreira/6dded03c8fa560fa991e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Routes all email from WP installation to specific Mailtrap | |
* account inbox. | |
* | |
* All you need to do is change the "Username" and "Password" | |
* settings to the appropriate box in Mailtrap. Then all | |
* mail **should** be routed to that box. Exceptions would | |
* be other functionality that overwrite the wp_mail() functions | |
* and may not use this filter, or other filters that change | |
* this behavior after we set it, or millions of other things. | |
* | |
* @param object $phpmailer - PHPMailer object (by reference) | |
*/ | |
function use_mailtrap($phpmailer) { | |
$phpmailer->IsSMTP(); | |
$phpmailer->SMTPAuth = true; | |
$phpmailer->Host = "mailtrap.io"; | |
$phpmailer->Port = 2525; | |
$phpmailer->Username = ""; | |
$phpmailer->Password = ""; | |
} | |
add_action( 'phpmailer_init', 'use_mailtrap' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment