Setup WP SMTP in WordPress with Contact Form 7 on Localhost
Here’s how to set up WP SMTP in WordPress with Contact Form 7 on localhost:
Step 1: Install the WP Mail SMTP Plugin
- Go to Plugins > Add New in your WordPress dashboard.
- Search for “WP Mail SMTP.”
- Click Install Now next to the WP Mail SMTP by WPForms plugin.
- After installation, click Activate.

Step 2: Configure WP Mail SMTP
- After activation, go to WP Mail SMTP > Settings in your dashboard.
- In the From Email field, enter the email address you want to send emails from (e.g.,
yourname@gmail.com). - In the From Name field, enter the name you want to appear as the sender.

Step 3: Choose Your Mailer
- Scroll down to the Mailer section and choose your preferred mailer option:
- Default (none): This will use PHP mail (may not work well on localhost).
- Other SMTP: Choose this if you want to use an SMTP server like Gmail, Yahoo, or your own server.

Step 4: Configure SMTP Settings
- If you selected Other SMTP, configure the following:
- SMTP Host: For example,
smtp.gmail.com(if using Gmail). - Encryption: Choose TLS.
- SMTP Port: Usually
587for TLS. - SMTP Username: Your email address (e.g.,
yourname@gmail.com). - SMTP Password: Your email password (consider using an app-specific password for Gmail).
- SMTP Host: For example,
- Save Settings after entering the SMTP details.

Step 5: Test the Email
- Go to WP Mail SMTP > Email Test in the dashboard.
- Enter an email address to send a test email to.
- Click Send Email to test if everything is set up correctly.

Step 6: Use Contact Form 7
- Create or edit your contact form under Contact > Contact Forms.
- Ensure the email settings in Contact Form 7 match the From Email in WP Mail SMTP.

- Save the form and place it on your desired page or post using the shortcode.

Step 7: Test the Form on Localhost
- Visit the page with your Contact Form 7 form.
- Fill out the form and submit it to test if the emails are sent correctly via WP SMTP.
That’s it! You’ve set up WP SMTP on your localhost and configured it with Contact Form 7 in WordPress.