SOLVED Mailgun rejects logins

owlight

Registered
Nov 6, 2019
4
1
3
United Kingdom
cPanel Access Level
Root Administrator
Hi,
I am using GCP to host Centos 7 with WHM/Cpanel. Because port 25 is closed for GCP, I decided to go with Mailgun, however, I cannot find a way to get authorized.

I followed this tutorial. (I was thinking to reply to it, but the top message confused me. So I decided to create a new topic) If I should just move it there, please let me know. (I will delete this one)

Okay, so...

So I followed the tutorial (everything is the same except for my login details) But I am getting this -


Code:
Transport port=25 replaced by host-specific port=587
Connecting to smtp.mailgun.org [52.45.160.225]:587 ... connected
  SMTP<< 220 ak47 ESMTP ready
  SMTP>> EHLO [[srv.example.com]]
  SMTP<< 250-ak47
         250-AUTH PLAIN LOGIN
         250-SIZE 52428800
         250-8BITMIME
         250-ENHANCEDSTATUSCODES
         250-SMTPUTF8
         250 STARTTLS
  SMTP>> STARTTLS
  SMTP<< 220 2.0.0 Start TLS
  SMTP>> EHLO [[srv.example.com]]
  SMTP<< 250-ak47
         250-AUTH PLAIN LOGIN
         250-SIZE 52428800
         250-8BITMIME
         250-ENHANCEDSTATUSCODES
         250 SMTPUTF8
  SMTP>> AUTH LOGIN
  SMTP<< 334 [[random letters]]
  SMTP>> ****************************
  SMTP<< 334 [[random letters]]
  SMTP>> ************************
  SMTP<< 535 5.7.0 Mailgun is not loving your login or password
LOG: MAIN
  mailgun_login authenticator failed H=smtp.mailgun.org [52.45.160.225] 535 5.7.0 Mailgun is not loving your login or password
  SMTP>> QUIT
  SMTP(close)>>
LOG: MAIN
  == [[destination email]] R=mailgun T=mailgun_transport defer (-42): authentication required but authentication attempt(s) failed
If there is anything I can provide, please let me know!
 

owlight

Registered
Nov 6, 2019
4
1
3
United Kingdom
cPanel Access Level
Root Administrator
Also, I have opened mailgun support ticket and they provided, this -

The only information we have on Exim is the below snippet from our docs. As the link mentioned, you will need to configure a smart host. For more information outside of the below, please see Exim’s documentation for authenticated outgoing SMTP.

Code:
  # In your exim.conf:
    # In routes configuration:
    mailgun:
     driver = manualroute
     domains = ! +local_domains
     transport = mailgun_transport
     route_list = * smtp.mailgun.org byname
    # In transports configuration:
     mailgun_transport:
     driver=smtp
     hosts_try_auth = smtp.mailgun.org

Also make sure to configure login credentials (in your /etc/exim/passwd.client):

Code:
  *.mailgun.org:username:password
 

cPanelLauren

Technical Support Community Manager
Staff member
Nov 14, 2017
13,304
1,247
313
Houston
Based on what you're providing it appears to connect to mailgun without issue, right up until authentication when it fails with the following:

Code:
  mailgun_login authenticator failed H=smtp.mailgun.org [52.45.160.225] 535 5.7.0 Mailgun is not loving your login or password
Furthermore, if the instructions in the resource were followed you should have matching entries to what mailgun sent you added to your exim configuration. With a couple of exceptions:

They note:

Code:
     hosts_try_auth = smtp.mailgun.org
where our resource which was tested in May notes:

Code:
hosts = smtp.mailgun.org
hosts_require_auth = smtp.mailgun.org
hosts_require_tls = smtp.mailgun.org
We also don't recommend putting the user/password in the same location - instead this should go in the AUTH section as noted in the example.


Can you show me what you have in /etc/exim.conf.local currently and what the output when you attempt to connect to mailgun is per the exim logs at /var/log/exim_mainlog as well as confirm the username:password are correct for mailgun
 

owlight

Registered
Nov 6, 2019
4
1
3
United Kingdom
cPanel Access Level
Root Administrator
Thank you for the response!

I was writing a reply with my Exim config and log and while doing it, I figured it out.

So basically, in Mailgun I went to domains -> my domain -> SMTP and there were proper credentials with a different SMTP server.

I have tried them before, but it didn't work, because I haven't changed the SMTP servers.

So after changing everything, my Exim config looks like this.



Code:
%RETRYBLOCK%
+secondarymx                    *                               F,4h,5m; G,16h,1h,1.5; F,4d,8h
*                               *                               F,2h,15m; G,16h,1h,1.5; F,4d,8h
@[email protected]
mailgun_login:
driver = plaintext
public_name = LOGIN
hide client_send = : [email protected][[mydomain]] : [[SMTPpass]]
@[email protected]

@[email protected]


@[email protected]

@[email protected]

@[email protected]

@[email protected]

@[email protected]

@[email protected]

@[email protected]

@[email protected]

@[email protected]

@[email protected]

@[email protected]

@[email protected]

@[email protected]

@[email protected]

@[email protected]

@[email protected]

@[email protected]

@[email protected]

@[email protected]
mailgun:
driver = manualroute
domains = ! +local_domains
transport = mailgun_transport
route_list = "* smtp.eu.mailgun.org::587 byname"
host_find_failed = defer
no_more
@[email protected]

@[email protected]

@[email protected]
mailgun_transport:
driver = smtp
hosts = smtp.eu.mailgun.org
hosts_require_auth = smtp.eu.mailgun.org
hosts_require_tls = smtp.eu.mailgun.org

It would be awesome if you could amend the tutorial that you need to verify your domain and get SMTP credentials in the dashboard, rather than this -


Code:
hide client_send = : EMAIL-USED-FOR-MAILGUN-SIGNUP:YOUR-MAILGUN-PASSWORD

Thank you for your help!
 

cPanelLauren

Technical Support Community Manager
Staff member
Nov 14, 2017
13,304
1,247
313
Houston
Hello,


It looks like you still have the hide client_send in the config - was it removed? I can definitely update the tutorial to reflect that the domain needs to be verified and you'll have to log in to the dashboard to get your SMTP Credentials though.

Thanks for that!
 

cPanelLauren

Technical Support Community Manager
Staff member
Nov 14, 2017
13,304
1,247
313
Houston
Hi,

This is the exim.config.local that works. What mailgun sent, it couldn't even contact their server (I was getting timed out error)

Thank you!
Great! Thanks! I'll update the documentation to reflect your suggestions as well