I'm running a CentOS 7 VM in Google Cloud but having difficulty sending emails out using sendmail. I've followed the below posts and numerous others but the result remains the same, i.e. the mails never reach their destination.
https://linuxconfig.org/configuring-gmail-as-sendmail-email-relay
https://www.bonusbits.com/wiki/HowTo:Configure_SendMail_to_Use_SMTP_Relay
https://tecadmin.net/sendmail-to-relay-emails-through-gmail-stmp/
http://ibgwww.colorado.edu/~lessem/psyc5112/usail/mail/debugging/
I've used a telnet session to connect to smtp-relay.gmail.com to test it from the server and was able to connect and send a mail, which also reached it's destination.
Please forgive my ignorance, I'm very new to Linux. When I use the mail -v command to send the mail I get the output below.
[root@backend-main-test mail]# echo "Just testing gmail relay" | mail -v -s "Sendmail gmail relay" [email protected]
[email protected]... Connecting to [127.0.0.1] via relay...
220 backend-main-test.c.somecompany.internal ESMTP Sendmail 8.14.7/8.14.7; Sun, 3 Jun 2018 17:59:57 GMT
>>> EHLO backend-main-test.c.somecompany.internal
250-backend-main-test.c.somecompany.internal Hello localhost [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:<[email protected]> SIZE=252
250 2.1.0 <[email protected]>... Sender ok
>>> RCPT To:<[email protected]>
>>> DATA
250 2.1.5 <[email protected]>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 w53Hxvqg002267 Message accepted for delivery
[email protected]... Sent (w53Hxvqg002267 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 backend-main-test.c.silveraxiom-prod.internal closing connection
[root@backend-main-test mail]#
It gives the message "Message accepted for delivery" at the end, but at the beginning it says connecting to 127.0.0.1 (localhost), should it not instead be connecting to the smtp-relay.gmail.com host I specified in the sendmail.mc and auth / authinfo files' configuration?
According to the /var/log/maillog when I execute those command it's giving the "Message accepted for delivery" like above and the relay is specified as 127.0.0.1
Sendmail relays messages via 127.0.0.1:25 to local sendmail daemon to avoid being set root id.
[Set root id sendmail had created long strem of security problems.]
To test your sendmail daemon configuration send test message as root in verbose mode with map lookups tracking (authinfo lookups).