My host is about to block port 25 and I’m unsure if WordPress requires port 25 to send emails like password reset, user registration, notifications etc…
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
WordPress sends emails via the wp_mail() method, which, by default, needs port 25 to be enabled in your php.ini settings:
For this function to work, the settings
SMTPandsmtp_port(default: 25) need to be set in your php.ini file.
You will have to change this setting if you would want to send mails via another port.
Method 2
If you need to use a port other than port 25, you don’t have to change this in your php.ini. You can change the port used by wp_mail() by changing the value in phpMailer. phpMailer is what wp_mail() uses when sending an email, and you can change the outbound port used as well as a number of other settings by setting these values when phpMailer is initialized:
add_action( 'phpmailer_init', 'change_my_email_port' );
function change_my_email_port( $phpmailer ) {
$phpmailer->Port = 587; // Set required port here.
}
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0