Problems with Contact Form 7 for Wordpress not working properly
After installing Wordpress, I immediately started customizing with content and plugins. One particular plugin I installed was the Contact Form 7 Plugin
After installing and configuring, I realized the plugin would give an error message: “Failed to send your message. Please try later or contact administrator by other way.” After digging around, I realized the Contact Form 7 plugin uses the PHP mail() function, which by default uses sendmail to send email. On my server, I had not installed sendmail yet. So after installing that… no more error message.
Now, after clicking send and waiting a REALLY LONG time, the form said “Your message was sent successfully. Thanks”. This was a hopeful message. However, when checking my inbox… no new messages.
After digging further, I noticed “DSN: Service unavailable” error messages in my /var/log/mail.log file, as well as complaints about my hostname being unqualified:
Oct 12 00:49:44 lamp sm-mta[3230]: My unqualified host name (lamp) unknown; sleeping for retry
Oct 12 00:49:46 lamp sm-msp-queue[3235]: My unqualified host name (lamp) unknown; sleeping for retry
So when using sendmail to send email messages, it’s best if the hostname of the machine is a FQDN. So I changed my hostname to the FQDN of my server
# sudo hostname www.matthardy.info
and restarted the sendmail service
# sudo /etc/init.d/sendmail restart
Now, sendmail works properly, and the form instantly and successfully sends the email message to my mail server!
Hope that helps some others of you out there having issues.
-Matt