0

This is my /etc/ssmtp/ssmtp.conf with omitted root, email, password, and hostname:

[email protected]
[email protected]
AuthPass=my_gmail_password
hostname=my_host_name

mailhub=smtp.gmail.com:587
rewriteDomain=gmail.com
FromLineOverride=YES
UseTLS=YES
UseSTARTTLS=YES

The file permissions are rw-r-----.


Although I had this conf saved I still got an error in WordPress (by the Contact Form 7 plugin, or CF7 in short).

No /var/log/mail.log or /var/log/ssmtp.log or any log file with a similar name was created (and I know I can create these with touch and assumed I'll do so if I'll feel it's really needed).

1 Answer 1

0

While writing this question I understood what was the problem, I took care of it, and then the email was sent successfully.

Preface

To understand my answer below, one has to ensure understanding of how email data gets transferred from a CMS (WordPress in this case), all the way to the final, destined email account. This chain describe it:

CMS and its contact form (WordPress with CF7) → php's mail() function → sSMTPSMTP (web service) → email-proxy station (Gmail) → final email destination (Gmail);

The problem and its solution

My sSMTP conf above was actually just fine. The problem came from my email proxy to which I've sent the data via sSMTP (Gmail):

You see, after you create an email account which will serve as a proxy (a medium) between the content sent via SMTP to your final destined email address, this proxy is generally useless for sSMTP and similar tools until you enable something in that email proxy itself !

In my email proxy, Gmail, what I had to enable is called "access for less secure apps".

  1. I got an email to Gmail saying "Review blocked sign-in attempt". I opened the email, and understood that Gmail will approve the IP address from which this data came if if I allow it. This email address is my VPS machine's IP.

  2. I allowed getting email sent via sSMTP which Google deemed "less secure app". I then I tried to send an email again from WordPress. This time, it went fine.

Summary

The problem was on Gmail's side --- I had to enable "access for less secure apps" there, then the email was sent and the data reached its final destination.


Notes

  1. That's a bit off topic but when I first started to learn on sSMTP I asked myself "how to ensure sSMTP` will work with more than one application. Here I got the answer at the time.

You must log in to answer this question.