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 remember Debian automatically sending mail to users (to report a failed sudo authentication attempt, for example). On Ubuntu is mail of some kind automatically set up? I created a cron job, and nothing is appearing in /var/spool/mail. If there's a standard/obvious way to set up mail in Ubuntu, what is it?

share|improve this question
    
paracaudex, @msh210 My answer here might help: how-are-administrators-supposed-to-read-roots-mail. –  user76204 Mar 19 '13 at 17:20
    
I had forgotten about this question. I ended up installing Postfix. –  bsamek Mar 19 '13 at 18:00

3 Answers 3

up vote 3 down vote accepted

If you haven't done it yet you will need to install postfix (sudo apt-get install postfix) or sSMTP (sudo apt-get install ssmtp) to replicate the sendmail commands.

share|improve this answer

Ubuntu has a policy of not listening on any network ports (not running any network services) by default. That means no mailserver. So, yes, you need to install one if you want one.

share|improve this answer

You can set up postfix to do local mail delivery only.

First,

sudo apt-get install postfix

After a moment, you'll be prompted to make some choices about how you want postfix installed. (If you make a mistake, you can get back here with sudo dpkg-reconfigure postfix).

When prompted, choose "Local only" as your general configuration. When prompted for a system mail name, you can enter your machine's hostname (e.g. gribble), its fully qualified domain name (e.g. gribble.strickland.us), or localhost. I suggest choosing the former or the latter.

With that done, do sudo postconf -e "home_mailbox = Maildir/" to tell postfix where to place users' mail. This appends home_mailbox = Maildir/ to the end of /etc/postfix/main.cf. sudo service postfix reload to tell postfix to reload the configuration file.

Now you can install a mail client that understands how to read mail out of your maildir, such as mutt: sudo apt-get install mutt

To configure mutt, create a file ~/.muttrc with something like the following in it:

set mbox_type=Maildir
set folder="~/Maildir"
set mask="!^\\.[^.]"
set mbox="~/Maildir"
set spoolfile="~/Maildir"

Run mutt and it will probably complain about your maildir not being there. This is fine -- postfix will create it as soon as we get some email.

In mutt, press m to compose an email. At the bottom of the screen, you'll be prompted for a recipient (you should be able to type user@hostname or just a user name) and subject, then your editor will pop up so you can type an email. Write something, save, exit, and press y to send. The user you sent to should have a Maildir appear in their home directory -- they can then use mutt (after creating a similar .muttrc) to read it!

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.