I first installed sendmail on ubuntu 17.04 by running sudo apt-get install sendmail
and then I made sure that the hostname of my machine was added to /etc/hosts/
right after localhost
like this:
127.0.0.1 localhost myhostname
I then ran sudo sendmailconfig
and answered yes to all the questions. I'm now trying to send some mail. I do this:
echo "Subject: sendmail test" | sendmail -v [email protected]
Sendmail prints the following:
ole@mki:~$ echo "Subject: sendmail test" | sendmail -v [email protected]
WARNING: local host name (localhost) is not qualified; see cf/README: WHO AM I?
[email protected]... Connecting to [127.0.0.1] via relay...
220 localhost ESMTP Sendmail 8.15.2/8.15.2/Debian-8ubuntu1; Mon, 14 Aug 2017 14:28:56 -0500; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
>>> EHLO localhost
250-localhost 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:<ole@localhost> SIZE=23 AUTH=ole@localhost
250 2.1.0 <ole@localhost>... 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
>>> .
I'm not sure what I'm supposed to do at this point. I tried putting a "." on a line by itself and returning but nothing happens. If I press ctrl C
I get the prompt back buy the email does not appear in my gmail inbox. Thoughts?
If you want to send Internet email directly then make
hostname --dqdn
(FQDN=Fully Qualified Domain Name) report name with existing DNSMX
(orA
) record. The exact procedure is Linux distribution dependent.You can force sendmail to use another name than auto-configured one but it is not "the best way" IMHO.