Sendmail from terminal to gmail not working

gmailsendmail

Hello I´m trying to send an email from my centos terminal with sendmail and it doesn´t work, the command I use the default configuration because I just want to send emails. I need help. In the next I use myuser@gmail.com, this would be my real gmail user that I want to send emails. What I do is:

[root@localhost ~]# echo "Subject: sendmail test gmail" | sendmail -v myuser@gmail.com 
myuser@gmail.com... Connecting to [127.0.0.1] via relay... 
220 localhost.localdomain ESMTP Sendmail 8.13.8/8.13.8; Fri, 3 Jun 2016 16:56:01 -0300
>>> EHLO localhost.localdomain 250-localhost.localdomain Hello localhost.localdomain [127.0.0.1], pleased to meet you 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-8BITMIME 250-SIZE 250-DSN 250-ETRN 250-DELIVERBY 250 HELP
>>> MAIL From:<root@localhost.localdomain> SIZE=29 250 2.1.0 <root@localhost.localdomain>... Sender ok
>>> RCPT To:<myuser@gmail.com>
>>> DATA 250 2.1.5 <myuser@gmail.com>... Recipient ok 354 Enter mail, end with "." on a line by itself
>>> . 250 2.0.0 u53Ju1vI022862 Message accepted for delivery myuser@gmail.com... Sent (u53Ju1vI022862 Message accepted for delivery) Closing connection to [127.0.0.1]
>>> QUIT 221 2.0.0 localhost.localdomain closing connection

But the email is not being recieved in gmail, and i see a verify=fail in the log. The /var/log/maillog shows:

Jun  3 16:56:01 localhost sendmail[22861]: u53Ju13j022861: from=root, size=29, class=0, nrcpts=1, msgid=<201606031956.u53Ju13j022861@localhost.localdomain>, relay=root@localhost
Jun  3 16:56:01 localhost sendmail[22862]: u53Ju1vI022862: from=<root@localhost.localdomain>, size=330, class=0, nrcpts=1, msgid=<201606031956.u53Ju13j022861@localhost.localdomain>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Jun  3 16:56:01 localhost sendmail[22861]: u53Ju13j022861: to=myuser@gmail.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30029, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (u53Ju1vI022862 Message accepted for delivery)
Jun  3 16:56:03 localhost sendmail[22864]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=AES128-SHA, bits=128/128
Jun  3 16:56:04 localhost sendmail[22864]: u53Ju1vI022862: to=<myuser@gmail.com>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:00:03, xdelay=00:00:03, mailer=esmtp, pri=120330, relay=gmail-smtp-in.l.google.com. [64.233.186.27], dsn=2.0.0, stat=Sent (OK 1464983764 l40si4464056qtc.52 - gsmtp)

Best Answer

The mail was actually accepted on the gmail side. That is shown in the last line in which you receive the following back from the receiving server: OK 1464983764 l40si4464056qtc.52 - gsmtp

The verify=fail is in regards to the TLS negotiation (I believe failing on the client side cert verification which is not typically enforced).

My first thought is that your mail may be getting dropped or at least added as spam based on your sender address. Additionally if you do not have PTR records configured for your server, then the server on their side cannot do a reverse lookup to verify you as the sender, which may also be getting it flagged as spam/non-legitimate mail.

Try and specify a valid sender/From address first to see if that will allow it to arrive.

Related Topic