Friday, March 12, 2010

WordPress Contact Form 7 & WP-Mail-SMTP problem solved

Latest Developments

Okay, I’ve updated this page a few times now. Here’s the real scoop.

You’ll have absolutely no problems with this whatsoever, you’ll be up and running in a few minutes – guaranteed! Just follow along.

1st Don’t bother with the WP-Mail SMTP plugin any more. There’s a much better plugin called Configure SMTP just open that window in another tab.

2nd Configuring the new plugin ‘Configure SMTP’ will take you only a few seconds, it’s so easy it’s unbelieveable. Just tick the box saying you want to use GMail, and just enter your Gmail (or Google Apps related) email address and password and that’s it. You’re up and running.

N.B.
I tested this plugin, and it successfully sent an email to my test account first time, no problems at all.

I’ve tested this plugin with Contact Form 7 and it instantly worked – no problem whatsoever.

Problems with Contact Form 7 and sending e-mail with SMTP simply don’t exist anymore.

I would also like to add that on this same server I’m independently running Drupal which also has a totally separate module for sending e-mail. I have seen absolutely no compatibility issues with this WordPress plugin at all and as a programmer myself would say that this entire system is ‘tickety boo’ (it’s a technical term – lol).

All the best

Simon

:)

-End-

Original Post

For historical reasons I have left my old post text here should anyone wish to read it for reference or sentimental value:

*UPDATE*

In light of new updates or whatever the problem was I had before with CF7 and WP-Mail SMTP it is now working and they do work together.

The process to get them working together was to install and configure the WP-Mail SMTP plugin first so you might want to uninstall your CF7 plugin (I don’t know if this is strictly necessary, but it only takes a few seconds and it’s what I did). For WP-Mail I personally use my GMail account to send mail through – it’s free and it’s the best service I’ve seen. If you don’t have a GMail account I highly recommend you set one up.

The settings for WP-Mail-SMTP for GMail you can see in my post here. I also used ‘tiny-contact-form’ to test the connection and to see that email is being sent through GMail correctly.

Once email is working properly I then installed the Contact Form 7 plugin and hey presto!

N.B. I’m using WordPress 2.8.2 WP-Mail-SMTP Version 0.8.2 and Contact Form 7 version 2.0 these are the latest as of 28th July 2009.

Why not try it out? While you’re at it, you might as well post me a comment :) One other thing to note: I have tried this on another site of mine but to no avail. I suspect it’s because all the hand coded modifications I’ve made to the various .php files. It might be an idea to backup your database, put a fresh install of WordPress on your system and get the contact form working earlier on before any hand coding is put in.

The other way around this problem is to use my old solution which is to use Tiny Contact Form which you can see in my original post at the bottom of this one.

All the best

Sci-Fi Si

[contact-form 1 "contact"]

You can now safely ignore my old post, but I’ve left it here for reference.

*Original Post*

You might just have managed to get WP-Mail-SMTP sending nicely when you send a test email, however if you try posting anything using Contact Form 7 you find you’re experiencing problems:

Contact Form 7 and WP-Mail-SMTP do not work together. This is because CF7 uses it’s own code for sending email, where WP-Mail-SMTP re-patches the WP_Mail() function which is more correct.

To fix your contact sending form problem simply download  a simpler form like ‘tiny-contact-form’ there are a number of other alternatives and other useful plugins I’ve seen which you can download from the skyje blog.

Here’s a sample form using Tiny-Contact-Form and WP-Mail-SMTP working together.

[wpcf]

Which I think looks nice and simple. The code for this came from a beautifully designed site http://yoast.com/wordpress/enhanced-wordpress-contact-form/ where he nicely offers the simple CSS style for this (which you just add to your styles.css file.

The main code for the plugin works through the wp_Mail() command and so this means if you’re using the WP-Mail-SMTP plugin to send your mail directly through your GMail account you won’t have a problem.

If you need a little help in setting up WP-Mail-SMTP to work with GMail you can read my post here http://www.caspianit.co.uk/gmail-smtp-settings/

Please make comment below if you get stuck or have any thoughts on this.

Simon

Related posts:

  1. WP Mail SMTP Settings for GMail.
  2. WordPress – PHP Warning: Invalid argument supplied for foreach() in php … on line 86
  3. Wordpress’ 20 BEST Plugins for Ultimate Blogging.
  4. IIRF Wordpress – URL Rewriting for IIS6.0
  5. Optimising WordPress SEO with the All in One SEO plugin


5 Comments

  1. Comments  dan in nyc   |  Monday, 24 August 2009 at 5:02 pm

    Thanks for this post. I’ve finally got WP-MAIL-SMTP and Contact Form 7 working thanks to your insightful post. I was pulling my hair out!!! Now I can move forward.

    Best,

    dan

  2. Comments  Adhamox   |  Thursday, 01 October 2009 at 5:13 am

    Thanks Simon,
    This worked for me on servage.net hosting

  3. Comments  M8ke   |  Thursday, 04 February 2010 at 12:22 pm

    Hi,
    That sounds nice… Here’s a question though : (i’m french so maybe i didn’t understand well)
    Will this work if i have 2 or three different forms (3 different email adresses) on my site ?

  4. Comments  Simon Nicol   |  Thursday, 04 February 2010 at 12:35 pm

    Hi M8ke,

    Yes. You should be able to set up as many contact forms as you like eg [contact-form1] [contact-form2] etc… Contact Form 7 is just the form. It’s how you send the mail that there were problems. The ‘Configure SMTP’ plugin will make the connection to GMail servers and do it’s thing.

    Just to let you know I don’t use CF7 any more. It’s too slow to load, it loads on pages where there are no contact forms and generally just add extra unnecessary weight to every page and as I’m hosting this site on my ‘home’ broadband it’s more important to me to reduce page loading times than having a contact form.

  5. Comments  M8ke   |  Thursday, 04 February 2010 at 1:12 pm

    Thanks !! that was a quick reply :)

    That’s an weird issue you had with cform7 (form loading on some random page ??????) I forgot to ask on my former post but can i use ‘Configure SMTP’ with my webhost mail service and what do i need to know from them to make it work ??

Leave a Reply