[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How does Cron send email?



On Wed, 2007-02-21 at 19:53 -0500, Grok Mogger wrote:
> Miles Fidelman wrote:
> > Grok Mogger wrote:
> >>     I was hoping someone could help me understand how cron magically 
> >> sends email.  My ultimate goal is to configure cron to send real 
> >> Internet email so instead of just getting mail on my unix accounts on 
> >> my linux box (which I read via the 'mail' command) I can get email at 
> >> my gmail account.
> > Basic answer comes from the manpage for cron:
> > 
> >       When executing commands, any output is  mailed  to  the  owner  
> > of  the
> >       crontab (or to the user named in the MAILTO environment variable 
> > in the
> >       crontab, if such exists).
> > so... simple answer is define MAILTO in your crontab
> > 
> > broader answer depends on what mail you want sent - you can always 
> > include a sendmail command in whatever script you're running
> > 
> > Miles
> > 
> > 
> > 
> 
> I have read the cron manpage.  I understand what cron mails and 
> under what conditions it mails it, what I don't understand is 
> HOW it mails it.  I know that cron just sends the output of 
> whatever script it runs.  I don't understand how it mails that 
> output.  I'd like to understand how it does that so that I can 
> make it send email to a gmail account or a similar "real" 
> Internet account.
> 
> Are you telling me that if I set my MAILTO entry to something 
> like 'Joe.Person@gmail.com', that's actually going to send 
> legitimate Internet mail to Joe at his gmail account?  I find 
> that hard to believe.

I have all of my machines at home configured to send all
"administrative" mail to my server which is on the internet. There fore
they need to have a real e-mail address.

You know you have an MTA running on your machine...

Just a snippet from /etc/aliases

        # /etc/aliases
        mailer-daemon: postmaster
        postmaster: root
        nobody: root
        hostmaster: root
        usenet: root
        news: root
        webmaster: root
        www: root
        ftp: root
        abuse: root
        noc: root
        security: root
        root: greg@gregfolkert.net

That is just from my personal workstation.

I have my MTA (exim4, exim4-base, exim4-config, exim4-daemon-light)
configured to have zero local mail. Any mail being forwarded to a smart
mailer. Which would happen to be my machine. Though I could configure it
to use Comcast's crappy servers, which would then send it to my
gregfolkert.net MX record.

Hope this helps.
-- 
greg, greg@gregfolkert.net

Novell's Directory Services is a competitive product to Microsoft's
Active Directory in much the same way that the Saturn V is a competitive
product to those dinky little model rockets that kids light off down at
the playfield. -- Thane Walkup



Reply to: