Fix Contact Form 7 on DigitalOcean

,

In the last blog post, I’ve stated why we decided to go with DigitalOcean and Server Pilot as a hosting solution for our website. After I installed WordPress, all the plugins that I use and added the content, it was time to check if everything works. Surprisingly one of my favorite plugins, Contact Form 7 would not work.

The problem?

When I tried to submit the contact form, the box with red borders bellows the form would show a message “Failed to send your message. Please try later or contact the administrator by another method.” At first, I thought I did something wrong when I installed the plugin, but I found two solutions.

1. Install Postfix.

Postfix is a simple open-source mail transfer agent. Installing Postfix is easy. Login to DigitalOcean account, select the droplet you want to install it and under the Access, tab click Console Access. The console will open, and all you have to do is run two command lines.

sudo apt-get update
sudo apt-get install postfix

After you run the command, you will be prompted to email configuration. Choose Ok, as you agree to the terms and conditions. In the next screen choose “Internet Site,” and in the last screen input your domain URL, for me was “mihai.info.” And this is it. I suggest restarting your droplet and check to see if your contact form works now.

2. Install Postman SMTP Mailer/Email Log Plugin

Postman connect to your Gmail account for example and uses email infrastructure to deliver your email. It has a simple wizard installation guide, the reason why I decided to recommend it.