SMTP for Contact Form 7

Description

WordPress uses PHPMailer to send mail from with your local mail server, but it can happen that your mail were not accepted by mail providers…
This can happen for several reasons, sometimes because the mail server is not configured or sometimes because the records DKIM, DMARC and SPF of the domain been set up correctly and so on…
Anyway you can avoid any problems by using an external SMTP server and sending mail with it!

Additional features

✅ OAuth2 Authentication: Securely connect to Gmail and Microsoft Office 365 without needing to store passwords in your database or enable “less secure apps”.
✅ Per-Form Custom Templates: Wrap CF7 emails with beautiful templates. You can now select a specific custom template for each form directly from the plugin settings!
✅ Global or CF7-Only Mode: Choose whether to override all WordPress emails with this SMTP configuration or limit it exclusively to Contact Form 7 submissions.
✅ Live testing: a module for testing e-mail settings with the Rest-Api (that avoid to reload the page for this kind of test). The entire output of the php mailer will be captured, which will be useful in case of configuration errors or to get the wrong parameter when is possible.
✅ Automated Reports: choose when and what email you want to receive the report and I will send you a beautifully formatted HTML summary of sent and failed emails. Includes log retention settings to keep your database clean.
✅ Advanced Headers & Security: Easily automatically set “Reply-To” headers, allow insecure options for self-signed certificates, and define custom “From Name” and “From Email” settings.

This plugin is ads free and I don’t want to try to sell you any pro version!
If you want to contribute, there are many ways to do so, from simple suggestions and bug reports to translating and contributing code.
See below how to do it!

SMTP

SMTP stands for ‘Simple Mail Transfer Protocol’.
It is a connection-oriented, text-based network protocol of the Internet protocol family and as such is on the seventh layer of the ISO/OSI model, the application layer.
Like any other network protocol, it contains the rules for proper communication between networked computers.
SMTP is specifically responsible for sending and forwarding e-mails from a sender to a recipient.
Since its release in 1982 as the successor to the ‘Mail Box Protocol’ in Arpanet, SMTP has become the standard protocol for sending e-mails.
However, the SMTP procedure remains largely invisible to the normal consumer, as it is executed in the background by the e-mail programme used.
Only if the software, the webmail application on the browser or the mobile e-mail application does not automatically determine the SMTP protocol when creating an account, does it have to be set manually to ensure smooth e-mail traffic.

SMTP presets

  1. Aruba
  2. Gmail (tls and ssl)
  3. Yahoo (tls and ssl)
  4. Outlook (tls and ssl)
  5. Office365 (tls)

OAuth2 Setup

Google Gmail
To use Gmail with OAuth2, you need to create a Google Cloud Project:
1. Create Project: Go to Google Cloud Console and create a new project.
2. Enable Gmail API (Required): Go to APIs & Services > Library, search for Gmail API, and click Enable.
3. Configure Consent Screen: Go to OAuth consent screen and create an External app.
* Scopes: Click Add or Remove Scopes, search for the Gmail API, and check the boxes for .../auth/userinfo.email and .../auth/gmail.compose (or https://mail.google.com/).
* Publishing Status: Click Publish App to push it to production (otherwise, your connection token will expire every 7 days).
4. Create Credentials: Go to