Problem: With correct login and password, and correct SMTP settings for Gmail SMTP, owncloud “Test email settings” button fails with:
- A problem occurred while sending the email. Please revise your settings. (Error: Failed to authenticate on SMTP server with username “bob@gmail.com” using 1 possible authenticators)
Other symptom (and hint): Gmail login works fine at other locations, home vs. work, for example.
First, in your gmail account settings, change the “Allow less secure apps” setting to ON. This is found at https://myaccount.google.com in section “Signing in to Google”. NOTE: This makes your gmail account less secure so you might want to create a throwaway gmail account just for SMTP (that’s what I did). I would not use my valuable gmail accounts:
- Allow less secure apps: ON
Other things to check:
- Ensure your owncloud user profile (not owncloud admin settings, but your actual user’s account) has an email address set. This address will receive email from owncloud for password reset email messages and email notifications. Find your user profile in the upper-right part of the web interface: your_name > Personal.
OwnCloud admin config for smtp:
Send mode: smtp
Encryption: TLS
From address: bob
@ (domain): gmail.com
Authentication method: Login
Authentication required: [checked]
Server address: smtp.gmail.com
: (port) 587
Credentials: bob@gmail.com, mypassword
If you don’t use the webui, Owncloud’s {$owncloud_dir}/config/config.php has these text configuration lines for smtp:
'mail_smtpmode' => 'smtp', 'mail_smtpsecure' => 'tls', 'mail_from_address' => 'bob', 'mail_domain' => 'gmail.com', 'mail_smtpauthtype' => 'LOGIN', 'mail_smtpauth' => 1, 'mail_smtpport' => '587', 'mail_smtphost' => 'smtp.gmail.com', 'mail_smtpname' => 'bob@gmail.com', 'mail_smtppassword' => 'mypassword',
Still doesn’t work? I had to also do the following:
Basically, google is smart and treats logins from different geographical locations with different security restrictions (blocks). In my case, my owncloud server was a VPS thousands of miles away from my laptop location. So I guessed that google didn’t like that some random location (my vps) was trying to access my gmail account (even though I had “Allow less secure apps” enabled.
I found a big hint that you can “unlock” or re-auth your google account with the following url:
https://accounts.google.com/UnlockCaptcha
So basically, to prove to google that my VPS’s IP address is legit, I had to do this UnlockCaptcha from my VPS. BUT, I have no web browser (gui) on my VPS! Except for ‘lynx’, the shell/cli based web browser! Lynx does work for passing the UnlockCaptcha url 🙂
#