I installed and configured a WordPress virtual machine appliance. The virtual machine was running in an intranet environment. An internal SMTP server was used which allowed to email relay into our Microsoft Exchange organization. The vm appliance had an admin option to configure the SMTP relay server.
I configured the IP address of the SMTP server. Whenever I posted a comment or any other action where WordPress needed to send out an email it took 30-60 seconds before the action was finished. After waiting for some minutes I also did not receive any email from the system.
Before troubleshooting and spending whole day in finding the root cause I read some posts to change the default WordPress behavior for email notifications with a SMTP server. The virtual machine had all LAMP roles and WordPress version 2.7 is running.
How to set WordPress to use external SMTP server?
- Go to ./wordpress/wp-includes and open file “pluggable.php”
- Search for “$phpmailer->IsMail();” and change the phpmailer setting to “$phpmailer->IsSMTP();” ; save and close the file
- Go to ./wordpress/wp-includes and open file “class-phpmailer.php” and search for “var $Host“; localhost should be defined.
- Change this to appropriate SMTP server in your environment. Save and close the file.
I used WinSCP to connect with SSH and change the files. Again posted some comments and received the admin notifications in my Inbox.