I've been trying to get command line sendmail to work, but no success. I need this to output my anacron error somewhere.

I've installed the sendmail package. Configured /etc/aliases with:

root: [email protected]

But whenever I'm trying to send an email to any address (root, [email protected]) the sendmail log keeps telling me its relayed to 'localhost' and sent. Never to be found again. Some files get made in /var/mail/mqueue.

Log output:

root@tok:/var/mail# sendmail [email protected] test37

Feb 27 13:35:40 tok sendmail[23616]: r1RCZanW023616: from=tys, size=7, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost
Feb 27 13:35:40 tok sm-mta[23617]: r1RCZe41023617: from=<[email protected]>, size=289, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA-v4, relay=localhost []
Feb 27 13:35:40 tok sendmail[23616]: r1RCZanW023616: [email protected], ctladdr=tys (1000/1000), delay=00:00:04, xdelay=00:00:00, mailer=relay, pri=30007, relay=[] [], dsn=2.0.0, stat=Sent (r1RCZe41023617 Message accepted for delivery)

Why does it decide that [email protected] should be delivered to localhost and does it never try to actually connect to gmail.com?

How should I configure this? I rather don't have any mailserver running at all. I just want the sendmail command to work and to forward my local root mails to mail address. Can't sendmail just lookup the MX record for the rcpt domain on itself and just deliver it there?

I've also tried putting the alias in /root/.forward, tried forwarding to local file. All without success. I've ran newaliases after editing /etc/aliases. I've tried restarting init.d/sendmail.

  • My answer for this question might be helpful, as this is how I set up local mail (although for different programs).
    – user76204
    Feb 27, 2013 at 15:18

1 Answer 1


I believe you mail is queued. Just try mailq and then sendmail -q or sendmail -q -v.

Possible is also, that email is being held because of unknown host. You need to have set localhost and your hostname in /etc/hosts

You normally don't need to use sendmail from command line to send emails, because it's not very convenient. You should use mailx or mutt

With mailx

echo you message  | mail -s subject user@host

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .