SMTP connect() failed Cannot send mails from contat us form

November 10, 2016 91 views
Email Joomla PHP One-Click Install Apps CMS Configuration Management

I have a vanilla joomla installation using Digital Ocean’s one click app install. I installed RS form plugin to send emails from the contact us form.
However, when the user fills out the form he gets the message: “SMTP connect() failed”
A bit of background:
I tried to change the settings on joomla to send emails from my gmail.
Here are the mail settings of the configuration.php file:
Mail from: myname@gmail.com
mailer = smtp
sendmail = /usr/sbin/sendmail
fromname = myname
smtpuser: gmail username
smtp password: gmail password
smtp security: tls
SMTP Host: smtp.gmail.com
i can connect via ssh to the terminal of my droplet

after doing so and executing the telnet command:” telnet smtp.gmail.com 587” this is what I get:

myserver:~# telnet smtp.gmail.com 587
Trying 173.194.79.108...
Connected to gmail-smtp-msa.l.google.com.
Escape character is '^]'.
At least we can see that it is connecting.

As far as the mail logs goes here I've looked at them and only can see sender of joomla and not from myself

myserver:/var/log# ls -lhrt mail*
-rw-r----- 1 syslog adm 827 Jul 24 06:47 mail.log.4.gz
-rw-r----- 1 syslog adm 632 Jul 30 06:39 mail.log.3.gz
-rw-r----- 1 syslog adm 775 Aug 7 06:34 mail.log.2.gz
-rw-r----- 1 syslog adm 2.9K Nov 7 11:54 mail.log.1
-rw-r----- 1 syslog adm 0 Nov 8 06:51 mail.log
myserver:/var/log# grep joomla mail* | wc -l
18
myserver:/var/log# zgrep joomla mail* | wc -l
87
myserver:/var/log# grep myname mail* | wc -l
0
myserver:/var/log# zgrep myname mail* | wc -l
0
Any ideas on what may be the problem?

Thanks

1 Answer

After doing some digging on this issue it appears that you'll need to take a couple extra steps within your gmail account in order to send via SMTP from Joomla.

This thread on the Joomla forums recommends:

You can get GMail to work with Joomla without modifying any code. Enable 2 step authentication on your Google account. In the Password & sign-in method in the Signing in to Google section of My Account you will now see an additional option, App Passwords. Generate a password for your website and use that in place of the regular one.
Have another answer? Share your knowledge.