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: 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 me@gmail.com 

Sendmail prints the following:

    ole@mki:~$ echo "Subject: sendmail test" | sendmail -v me@gmail.com 
    WARNING: local host name (localhost) is not qualified; see cf/README: WHO AM I?
    me@gmail.com... Connecting to [] 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 []
    >>> EHLO localhost
    250-localhost Hello localhost [], pleased to meet you
    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:<me@gmail.com>
    >>> DATA
    250 2.1.5 <ole.ersoy@gmail.com>... 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?

  • I know from experience that Gmail has strict authentication protocols which make for a hard time with SendMail. You might have better luck with this question on askubuntu.com – KidACrimson Aug 14 '17 at 22:02

If you want to send Internet email directly then make hostname --dqdn (FQDN=Fully Qualified Domain Name) report name with existing DNS MX (or A) 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.