I am trying to send emails from my ubuntu server using sendmail
command.
I ran command echo "Subject: Sendmail test" | sendmail -v <My_Id>
, which ran without any errors but still I don't receive any emails.
<My_Id> ... Connecting to [127.0.0.1] via relay...
220 ip-<server-IP>-<region>.compute.internal ESMTP Sendmail 8.14.4/8.14.4/Debian-4.1ubuntu1.1; Wed, 29 May 2019 14:08:42 GMT; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
>>> EHLO ip-<server-IP>-<region>.compute.internal
250-<server-IP>-<region>.compute.internal Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-EXPN
250-VERB
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
>>> VERB
250 2.0.0 Verbose mode
>>> MAIL From:<ubuntu@ip-<server-IP>-<region>.compute.internal> SIZE=23 AUTH=ubuntu@ip-<server-IP>-<region>.compute.internal
250 2.1.0 <ubuntu@ip-<server-IP>-<region>.compute.internal>... Sender ok
>>> RCPT To:<My_Id>
>>> DATA
250 2.1.5 <My_Id>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
050 <My_Id>... Connecting to gmail-smtp-in.l.google.com. via esmtp...
050 220 mx.google.com ESMTP q73si7270078pjq.89 - gsmtp
050 >>> EHLO ip-<server-IP>-<region>.compute.internal
050 250-mx.google.com at your service, [<IP>]
050 250-SIZE 157286400
050 250-8BITMIME
050 250-STARTTLS
050 250-ENHANCEDSTATUSCODES
050 250-PIPELINING
050 250-CHUNKING
050 250 SMTPUTF8
050 >>> STARTTLS
050 220 2.0.0 Ready to start TLS
050 >>> EHLO ip-<server-IP>-<region>.compute.internal
050 250-mx.google.com at your service, [<Server_Public_IP>]
050 250-SIZE 157286400
050 250-8BITMIME
050 250-ENHANCEDSTATUSCODES
050 250-PIPELINING
050 250-CHUNKING
050 250 SMTPUTF8
050 >>> MAIL From:<ubuntu@ip-<server-IP>-<region>.compute.internal> SIZE=398
050 250 2.1.0 OK q73si7270078pjq.89 - gsmtp
050 >>> RCPT To:<My_IP>
050 >>> DATA
050 250 2.1.5 OK q73si7270078pjq.89 - gsmtp
050 354 Go ahead q73si7270078pjq.89 - gsmtp
050 >>> .
050 250 2.0.0 OK 1559138663 q73si7270078pjq.89 - gsmtp
050 <My_IP>... Sent (OK 1559138663 q73si7270078pjq.89 - gsmtp)
250 2.0.0 x4TE8g85010394 Message accepted for delivery
My_IP... Sent (x4TE8g85010394 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
I also checked if the server is able to connect to the google SMTP box telnet gmail-smtp-in.l.google.com 25
, which also works fine:
Trying <IP>...
Connected to gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP m24si25196886pgj.127 - gsmtp
Also, when I checked mail queue using mailq
it showed nothing:
MSP Queue status...
/var/spool/mqueue-client is empty
Total requests: 0
MTA Queue status...
/var/spool/mqueue is empty
Total requests: 0
I know something is misconfigured for sendmail
to work.
But as I am new to this command, I need help in figuring this out.