Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

But whenever I'm trying to send an email to any address (root, me@gmail.com) 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 me@gmail.com test37

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

Why does it decide that me@gmail.com 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.

share|improve this question
    
Thank you Eric. –  knifter Feb 27 '13 at 14:02
    
My answer for this question might be helpful, as this is how I set up local mail (although for different programs). –  user76204 Feb 27 '13 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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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