Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get outbound email working in self-hosted SugarCRM 6.5

Tags:

sugarcrm

I can't seem to get outbound email working from my SugarCRM installation, with only the message SMTP connect() failed appearing in the logs.

I've set my smtp server to smtp.gmail.com, email address, password, TLS, port 587. When I go to 'Send Test Email' I get the error.

I've set my local hostname, installed openssl, set the host_name in config.php and included it as a referrer in config_override.php. I've also tried setting SMPTDebug to 2 in SugarPHPMail.php but that seemed to have no effect.

When I run openssl s_client -starttls smtp -crlf -connect smtp.gmail.com:587 the output includes Verify return code: 0 (ok) and I don't know where to go from here. I can connect via telnet to that host & port and get a 220 SMTP message back as expected.

I do also have an exchange server available, but haven't been able to get that one working either, and thought Gmail would be more easily-solved.

I'm on Sugar 6.5.26 hosted on Linux (Debian, Raspbian).

like image 362
Jeremy Jones Avatar asked Oct 17 '22 09:10

Jeremy Jones


1 Answers

Ok I found the solution while looking for the 'Allow less secure apps' setting in Gmail.

I have two-step authentication switched on in my Gmail account, which will obviously complicate things but had slipped my mind. Therefore I needed to use an app-specific password, and not my normal Gmail password.

As soon as I created an app-specific password in Google (at https://myaccount.google.com/apppasswords) and plugged that into the SugarCRM settings, it worked fine. D'oh!

like image 153
Jeremy Jones Avatar answered Oct 21 '22 09:10

Jeremy Jones