# Setting up mail

## haarp

Hey there.

cron tends to mail it's output to root. This is a good thing, as it insures that I won't lose any potentially important information. The only problem is, that I don't have mail set up on my system. As a consequence, mails tend to pile up in /root/dead.letter.

I have never set up mail on a Linux system before. I don't want/need a full-blown mailing daemon or anything like that. So how does it work? After looking around Google for a few mins, I figured that I send mail to my mail provider and then download it again with my mail client/look at it with the web interface. That would be fine by me.

Gentoo has SSMTP installed by default, which uses /etc/ssmtp.conf for its settings. mailhub=mail.emailprovider.com would send the mails to my providers SMTP server, but I don't see any authentication. This is not going to work like this. How does the mail server know that this mail is intended for haarp@emailprovider.com? What's wrong here? Sorry, I don't really quite grasp the concept.

----------

## Mad Merlin

Your ISP's SMTP server doesn't usually require authentication, as they can just whitelist IPs that they control. As for actually routing the mail, that's what all the email headers are for, when your mail gets sent, it'll have a "To: foo@bar.com" header, and the SMTP server will look up the mail server for bar.com and deliver the mail to that server. As for actually reading your mail, that does require authentication, and has nothing to do with sending mail.

Edit: ssmtp does support sending mail through SMTP servers that require authentication, but you probably don't need to worry about that.

----------

## haarp

Thanks!

My ISP has no SMTP server. Only my mail provider does (GMX), and afaik it needs authentication.

Regarding the header, where do I set the recipient? Is that the "MAILTO" option in the crontab? If so, can I simply set it to "haarp@provider.com"?

Edit: Found this: http://en.gentoo-wiki.com/wiki/Gmail_and_sSMTP

I quickly set up a Gmail account. Mail seems to work for me now (rkhunter, smartd). I'll have to see what cron does tonight though.

----------

## Mad Merlin

 *haarp wrote:*   

> Regarding the header, where do I set the recipient? Is that the "MAILTO" option in the crontab? If so, can I simply set it to "haarp@provider.com"?

 

Yes.

----------

