Rashmi Ranjan Padhy
Rashmi Ranjan Padhy

Reputation: 41

SMTP authentication failure while using SendGrid/Gmail

I am getting SMTP Authentication Failure on the server and the mail is getting send via the server SMTP only...

It appears to be a server configuration or related problem, but I am not sure.

This is the debug details:

250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
250-STARTTLS
250 HELP

Failed to authenticate password. Error: 535 Incorrect authentication data

from: 250 OK

to: 250 Accepted

data: 354 Enter message, ending with "." on a line by itself

250 OK id=1U8Pjp-0002As-FB

quit: 221 ************** closing connection

Your message has been successfully sent using the following protocol: smtp

While testing from my local system, this works and the email is being sent via sendgrid.me

Again, This may not be a SendGrid Problem, but if you have faced similar issue, Can you please tell me what is the problem here?

I am using CentOs and I have cPanel in the server. I believe we are using EXIM for mail server.

Upvotes: 3

Views: 3853

Answers (3)

Usman Ali Maan
Usman Ali Maan

Reputation: 424

I am using centos 7 Finally it works!

I was getting this issue(tail -f /var/log/mailog):

to=<[email protected]>, relay=smtp.sendgrid.net[169.45.113.201]:587, delay=0.3, delays=0.05/0.07/0.16/0.02, dsn=5.0.0, status=bounced (host smtp.sendgrid.net[169.45.113.201] said: 550 Unauthenticated senders not allowed (in reply to MAIL FROM command))

Then i changed file /etc/postfix/main.cf in this way that added following lines into end of file

mtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
mailbox_size_limit = 256000000

# Sendgrid Settings
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:apikey:SG.YOUR_SENDGRID_KEY
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
header_size_limit = 4096000
relayhost = [smtp.sendgrid.net]:587

Then Installing postfix missing module dependency using:

sudo yum install cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain

Then restarting postfix

sudo systemctl restart  postfix.service

Upvotes: 0

MikeyBeLike
MikeyBeLike

Reputation: 833

For anyone that comes across this in future and are using cpanel/whm, you need to 'disable' this option under 'SMTP Restrictions' in WHM.

Upvotes: 5

Rashmi Ranjan Padhy
Rashmi Ranjan Padhy

Reputation: 41

I was able to resolve this.

The issue was my server was not allowing the use of external SMTP and using its own SMTP server. I changed the settings and now it works fine.

Upvotes: 1

Related Questions