Adding SMTP to your Contact Form in 2.0.2
Hey guys,
Just a short post for anyone experiencing problems with the contact form on their blog. 2.0.2 now comes with the option to use SMTP to ensure your mail gets through. This tip will assist you if you receive the “Could not instantiate mail function” error when testing your form. It looks like this:
This means that PHP and Sendmail are not working together nicely on your server, but do not despair. If you have an email account with anyone that provides you with SMTP access (Gmail, perhaps your own server, or even your Internet service provider) you may enter those details into your contact form to correct this.
Start by opening up the file contact_form.php in your theme folder (in my case wp-content/themes/OneTheme/contact_form.php), and scroll down until you see this section:
Now we have to uncomment the lines by removing the two forward slashes at the start of each line, and entering our SMTP details in-between the single quotes. As an example I will change the Username to ‘karl@one-theme.com’:
Thats really all there is to it! Save, and upload and as long as you entered working SMTP details your contact form should work like a charm.
Until next time!
Karlo









Excellent Karl
I have loaded v2.0.2
I have downloaded contact_form.php
I have input the gmail account details as per my account with gmail (removing the //’s)
The form is here: http://www.etoiledumatin.ca/?page_id=738
this is the error message I get.
Warning: fsockopen() [function.fsockopen]: unable to connect to pop.gmail.com:25 (Connection refused) in /home/condo27/etoiledumatin.ca/wp-includes/class-smtp.php on line 122
Hey
Gmail doesn’t use port 25 as standard as they use TLS encryption. You could try changing the port number to 465 or 587 as per the instructions here:
http://mail.google.com/support/bin/answer.py?hl=en&answer=13287
have a single hosting service looking after 5 low traffic domains. One-theme is on two of the domains. Contact form works well on one site but not the other? The site that works has the original code.
http://blog.versantsoleil.co.uk/reservations/contact
This leaves this site at etoiledumatin.ca where the form does not work
http://www.etoiledumatin.ca/reservations/contact
Both run 2.02
but the site that works has had the onepanel downloaded from your overnight zip file collection. Is this the cause?
I have tried overiding the code in accordance with your very clear instructions to link it to gmail. I have read the notes and tried ports 465 & 587 without success.
I am on the brink of success Karl! the solution is within touching distance but my logic is defeating me!
Can you take a look at my website? I got some problems with One Theme.
Yes, Gmai use port 465 and 995. Thanks
Hi Karl, Jay!
How are you guys doing???????????
Haven’t heard from you in a while, is everything ok? Is One Theme still alive?
I must admit I’m getting a little worried…no more activity in the forums since October 2009…?
If there is anything to announce, please let us know…
Thanks,
Michael