Highlighted
New Member
Posts: 18
Registered: ‎03-25-2015

Cannot get mailer to connect

Hi,

 

I'm having a issue with the mailer, i'v tried gmail and also our exchange server and cannot get a connection. keeps saying it cannot connect to host. I know the server has internet as its been allowed through our firewall in whitelist, any idea's at all or tricks?

 

Thanks!

Ubiquiti Employee
Posts: 1,473
Registered: ‎03-21-2016
Kudos: 242
Solutions: 159

Re: Cannot get mailer to connect

Hello @j-servers, could you please post the exact error message? If it looks something like this "Connection could not be established with host smtp.example.com [php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known #0]", it could be a DNS problem.

There are some known problems with Docker and DNS when you have more than one name server configured in your system. Also if you have none, Docker defaults to Google's DNS server which could be blocked from your network. If this is your problem, this article could help https://robinwinslow.uk/2016/06/23/fix-docker-networking-dns/

New Member
Posts: 18
Registered: ‎03-25-2015

Re: Cannot get mailer to connect

[ Edited ]
Hi, The error is: Connection could not be established with host mail.example.com [ #0], Yes we have 2 DNS Servers running and i'v checked and googles dns servers are allowed. I am able to resolve sites from the console too. Another error is: Failed to authenticate on SMTP server with username "" using 0 possible authenticators
Ubiquiti Employee
Posts: 1,473
Registered: ‎03-21-2016
Kudos: 242
Solutions: 159

Re: Cannot get mailer to connect

Can you try to connect into the UCRM container and ping the host from there? You can connect using the following command:

sudo docker exec -ti ucrm_web_app_1 sh
New Member
Posts: 18
Registered: ‎03-25-2015

Re: Cannot get mailer to connect

Yes, can ping our mail server and also mail.google.com
Ubiquiti Employee
Posts: 1,473
Registered: ‎03-21-2016
Kudos: 242
Solutions: 159

Re: Cannot get mailer to connect

Ok, that's weird. Could you please screenshot the mailer configuration from System -> Settings -> Mailer and send it to me in PM?

New Member
Posts: 34
Registered: ‎11-11-2017
Kudos: 1

Re: Cannot get mailer to connect

Was there a solution to this, I am getting the same error on a fresh server install. on 2.10 beta 4, That docker command above didn't work for me, said no such container, but I can ping the mail server from the command line.
New Member
Posts: 34
Registered: ‎11-11-2017
Kudos: 1

Re: Cannot get mailer to connect

I'm still at a loss as to why I get this error.. Connection could not be established with host mail.myserver.net [ #0] I've checked and rechecked the settings, and I tested the email with the unms software and it works for it just fine.
Ubiquiti Employee
Posts: 4,145
Registered: ‎12-10-2015
Kudos: 1469
Solutions: 315

Re: Cannot get mailer to connect

@CamP This is most likely related to the docker DNS problem. Use the UCRM in-app Troubleshooting guide - section Unresolved DNS problem for more info.
The issue was also discussed here: https://community.ubnt.com/t5/UCRM/Connection-could-not-be-established-with-host-smtp-gmail-com-php/...
New Member
Posts: 34
Registered: ‎11-11-2017
Kudos: 1

Re: Cannot get mailer to connect

@UBNT-Petr I attempted to do the fix as described, but it still fails. The nslookup command at the bottom of that page even works, it resolves the domain. I even tried using the mail servers IP address in the settings to bypass any DNS problem, and it still fails with the #0 error.
Ubiquiti Employee
Posts: 4,145
Registered: ‎12-10-2015
Kudos: 1469
Solutions: 315

Re: Cannot get mailer to connect

@Capm that's strange. Can you please verify the connectivity from the container?

First, enter the container with:

sudo docker exec -ti ucrm_web_app_1 sh

where ucrm_web_app_1 is the name of the main UCRM container. If yours has different name, you can list them with: sudo docker ps

 

Once you are in the container, try to ping the mail server domain and IP.

 

New Member
Posts: 34
Registered: ‎11-11-2017
Kudos: 1

Re: Cannot get mailer to connect

@UBNT-Petr I can ping my mail domain from within the app.
New Member
Posts: 34
Registered: ‎11-11-2017
Kudos: 1

Re: Cannot get mailer to connect

[ Edited ]

Here is an image of my mailer settings and the error

error.jpg
Ubiquiti Employee
Posts: 4,145
Registered: ‎12-10-2015
Kudos: 1469
Solutions: 315

Re: Cannot get mailer to connect

@Capm Are you sure the connection settings are correct? Can you PM me which mail server you are using?
New Member
Posts: 34
Registered: ‎11-11-2017
Kudos: 1

Re: Cannot get mailer to connect

@UBNT-Petr PM sent