To set up contact forms for WordPress on Google Cloud, There are 4 important steps to follow. Please note that we assume that you already have a WordPress website installed on Google Cloud, if not, please read this
- Install form generator Plugin
- Install Mail Plugin
- Create a Gmail web App
- Test your work
1. Install Contact Form 7 Plugin and Edit Settings
You will need to install and activate is Contact Form 7. This plugin will be used to create contact forms for WordPress
- Install the plugin
- Activate it
- In the left menu go to contacts
- Create a form
- Navigate to the Mail tab, and change the “To” field to the Gmail/G suite address where you want the contact form submissions to be sent.
- Save form
- Copy the form shortcode
- Past the form shortcode on the page you want the form to appear on
2. Install WP Mail SMTP Plugin and Edit Settings
Install and activate the WP-Mail-SMTP plugin. This plugin will be used to re-configure your mail settings.
- Install the WP Mail SMTP Plugin
- Activate the plugin
- Navigate to settings and choose Gmail
- Add your Gmail / G Suite account and save
3. Create a Gmail Web Application
sign into your Gmail account and access Gmail’s application registration
Create a project Next, you should see a screen that says “The API is enabled
Click the Go to credentials button.
- Which API are you using? Gmail API
- Where will you be calling the API from? Web server (e.g. node.js, Tomcat)
- What data will you be accessing? User data
- Click the What credentials do I need?
- Click on Set Up Consent Screen Option.
- Application name is website name
- Authorized domain your domain
- Save information
- Click on create Credentials
- Choose Oauth client ID
- Choose web application
- Authorized JavaScript origins add your domain
- Get the Authorized redirect URIs from the WP Mail SMTP Plugin page and paste it
- Click create
- Copy the Oauth client info and paste on the WP Mail SMTP Plugin setting
- On the WP Mail SMTP Plugin setting Click on Allow plugin to send emails using your Google account
4. Send Test Emails
- On WP mail SMTP plugin page navigate to email test
- Add any email of yours and click test
- Test also the contact forms for WordPress you added to your website
- If it did not work you might need to Allow Less Secure Apps https://myaccount.google.com/lesssecureapps