While trying to configure gmail SMTP on my OwnCloud installation, I continued to run into an authentication issue. Oddly enough, I have several other areas where I have this working without issue (server & webcam) and so I'm no stranger to the configuration and setup. I was nearly stumped when I found a solution that may help others as well.
I finally found the following "
https://accounts.google.com/UnlockCaptcha". Captcha was causing the hiccup. By unlocking the account, all was back to normal and emails could be sent from my cloud server.
My OwnCloud 8.1.1 config is as follows;
'mail_smtpmode' => 'smtp',
'mail_from_address' => 'mygmailacct',
'mail_domain' => 'gmail.com',
'mail_smtpsecure' => 'tls',
'mail_smtpauthtype' => 'LOGIN',
'mail_smtpauth' => 1,
'mail_smtphost' => 'smtp.gmail.com',
'mail_smtpport' => '587',
'mail_smtpname' => 'mygmailacct@gmail.com',
'mail_smtppassword' => 'MyPassword',