[Nottingham] e-mail from a shell...

Peter Chang Peter.Chang at nottingham.ac.uk
Wed Apr 21 17:04:26 BST 2004

On Wed, 21 Apr 2004, David Wolfson wrote:

[Stuff about MAILTO in crontab]

> Should it e-mail (as in the same stuff that seem to get from female
> students in the US, and bankers in nigeria) the cron output to the
> address given, or is it only designed to mail the type of stuff I get
> when I type 'mail' in a Linux shell?  If the second is true, then I'll
> go away and try to configure my crons for that, but if it's the first,
> then mine doesn't work.

Can't you try it out? Look at the man pages (man mail and man 5 crontab).
It works for me locally though I can't try internet emails as the uni
seems to block port 25 stuff at the moment.

> I've also tried using the 'mail to' command in a shell, appears to
> work but never arrives.  I'm guessing that I have to configure this
> command, but when I try and to a google/linux-questions search I get a
> huge list of peoples e-mail links.  Not very helpful.
> Am I barking in the wrong woods?  Is it possible to send e-mail in the
> form I want from a shell script?  If so, could anyone point me in the
> right direction?  I'd like to be able to find out from my inbox if my
> cron jobs have run ok...

There's more than one way to skin a cat. By default, the output from a
cron job goes to owner of the job. Maybe you could use a .forward to pass
it on another account. That's assuming your mta is set up properly. The
mailx package on my RH9 box says it is "often used in shell scripts".


This message has been scanned but we cannot guarantee that it and any
attachments are free from viruses or other damaging content: you are
advised to perform your own checks.  Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

More information about the Nottingham mailing list