Skip to content
Aug 16 / kkrizka

WP-ContactForm and Web Hosts That Can’t Send E-Mail

One problem with free web hosts, like FreeHostia, is that they block sending outcoming email from PHP scripts. This can become problematic for people that want to host forums and personal blogs that send out email notifications. There is usually no way around this, but some emails can still be enabled, or worked around. In this article, I will describe how I implemented the wp-contactform to let users “email” me.

The wp-contactform plug-in lets your visitors send you emails without you having to expose your email address to everyone. It is a simple text area where users can write their message, and the email is then sent automatically by PHP. You can see it in action on my “contact me” form. Of course, it won’t work with free web hosts with reasons mentioned earlier. My solution is the following; don’t send an email, instead save the email as a file so you can read it later. It might not be as comfortable as having it delivered straight to your mailbox, but that’s what you get for being cheap like me and not paying for your hosting.

I have uploaded my modification so everyone can use it. You can download it here: WP-ContactForm No-Email Modification (Build 1)

Installation and Usage

To install it, just follow the installation instructions that came with the original wp-contactform plug-in. Make sure to test your installation by sending yourself a message. To check if it all worked, view your messages by going into a new directory created in the root of your WordPress installation called “mail”. It should have your massage in a text file named in the following format, “date time – subject.txt”. Every message you receive will be in a seperate file.

Now just make sure that the directory is password protected, so random people won’t be allowed to read your messages. I suggest using an .htaccess file, which is explained by this comprehensive guide to .htaccess.

Trubleshooting

If the “mail” directory does not exist after you have tried to send a message, try to create it manually. Then make sure it has 777 permissions, because the web server needs to be able to write to it. If sending another message still does not work, then leave a comment here or contact me.

Future

I am planning to do a few more modifications on this plug-in. For example, I’m planning to have the messages stored in the database, and crease an interface for reading them inside your WordPress Control Panel. If you would like to be updated on the development of my modification, then subscribe to my RSS feed. I’m also looking for more suggestions and feedback.

Leave a comment