You are here: Home » Extending WordPress » Configuring Email On Localhost For Running WordPress Offline

Configuring Email On Localhost For Running WordPress Offline

by Dave Doolin on July 4, 2009

(Reading time: 2 – 3 minutes)

Once you’re running WordPress on localhost, that is, offline, you may want to take it to the next level and set up an SMTP service to test more complicated activities such as membership registration.

I had to do this to be able to efficiently test AWeber Super Simple, my plugin allowing people registering for your blog to sign up for your AWeber autoresponder at the same time. Testing over a network connection was truly miserable.

Setting up mail server is easy

Setting up hMailServer

Setting up hMailServer

The first thing you need to do is find out whether you have a mail server installed. If you’re on a LAMP stack, look for sendmail. If you don’t know what a LAMP stack is, you check to see if Windows has an email server running. If not, it’s really simple to install hMailServer, a small, simple, secure mailserver for your own computer.

From the web page:

It [hMailServer] supports the common e-mail protocols (IMAP, SMTP and POP3) and can easily be integrated with many existing web mail systems. It has flexible score-based spam protection and can attach to your virus scanner to scan all incoming and outgoing email.

Just follow the directions for installation. Very easy. Once you have it installed, you need to configure hMailServer. Here’s a screenshot of my configuration.

Tell PHP to use local email

Once you have the mailserver installed, you need to tell PHP about it. Find your php.ini file, make the changes as shown in the following code snippet:

706
707
708
709
710
711
712
[mail function]
; For Win32 only.
SMTP = mail.tinobox.com
smtp_port = 25
 
; For Win32 only.
sendmail_from = admin@localhost.com

The line numbers may not be exactly the same in your php.ini file, but they will probably be very close. Make sure to restart Apache after you make the changes to php.ini!

And that should be all there is to it. You should be able to send and receive email directly on your personal computer now. If you set up your locally hosted WordPress installation with your locally hosted SMTP server, you should be able to email posts to your blog directly from your email client.




Would you like more? Send me a letter...
"Hi Dave,
Website In A Weekend seems pretty cool. I'm serious about this WordPress and web stuff, and I'd like to keep up with it. My name is and my email address is . I'm comfortable with email newsletters. I know you will protect my privacy, and that I can unsubscribe at any time. "

Comments on this entry are closed.

Previous post:

Next post: