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.
Mauricio
Hi.
Thanks for this tutorial. I need help with it.
Could you be more specific as to what I have to change for WP notification to go through in class-phpmailer?
Also, my cforms plugins isn’t working. The messages sent with the cforms don’t go through.
You can see this form at blackberryrocks.com/contact.
Would you be able to help? Thanks!
Mauricio
I’m using WP 2.7.1 on a virtual dedicated server, just in case.
Richard
That
Racing Diary
this worked perfectly! Now I get comments!
Mel Wordpress
I tried this sugguest and it everything I added a post or added a new user I got a white screen. I had to revert back. I’m using 2.8.2 I’m not sure what else I can do to recieve emails when someone post a comment this was working before I updated. Any?
David
A WP plug-in exists that does this without having to hack php pages.
Try this:
http://wordpress.org/extend/plugins/wp-mail-smtp/
Fred
I’ve tried this, alas no success. I’m on WP 2.8.6, so who knows. I’ve tried various contact form plugins and such, and I give up. The easiest thing to do seems to create a “Contact” page and just stick in an email link like this:
E-mail Me!
Works just fine everytime, and all the rest of this stuff is way too confusing.
Face Ajan
Facebook Şifre Alma Programı
Bilgisayara Girme Programı
personal software
i am happy to find it thanks for sharing it here. Nice work.
Ivan Versluis
Thank you!
online movie downloads
Awesome web site, I hadn’t noticed http://www.networknet.nl before in my searches!
Keep up the wonderful work!
Deepak keswani
Thank you so much,
My sendmail program even through routed to smtp relay was querying dns server.
Unfortunately there is no DNS inside the DMZ.
Routing the php code directly to smtp relay worked well.
Now My only concern is, if i update the WordPress with patch release, do i loose these changes ?
Istvan
@Deepak keswani: Yes, you will lose the settings with a wordpess update, it happened to me too.
Peter
worked perfectly.
Allowed me to stop using a plug-in, which speeded up the site. dropped plug-in load time from 16.6% to 5.1% of time.
Thanks for the simple explanation, as it was hard to find where to make changes before finding this.