• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 234
  • Last Modified:

Sending mail to admins from Linux

Hi guys,

Really appreciate your help here.

Just like to know:

I have daily cron jobs that run on my linux box.
Id like the results of those cron jobs to be mailed to myself.
I know the ip address/host name of my smtp server.
What commands and configuration do I need to be able to do this from linux?

For example, do I need to set up something on my linux so that linux knows how to talk to the smtp server?
Also, Ive heard that the mail command can do this.

Do I need to install sendmail on my linux box?
I dont want the linux to be a mail server, just the ability to be able to send mail from it.

Thanks in advance.

2 Solutions
> Do I need to install sendmail on my linux box?
Yes, mail software, which sendmail is the one. Postfix is also another
You can config your sendmail to only accept email from localhost.

> mail command can do this.
At the end of your cron script (assume your result is stored in a result file called result1.txt),
mail -s "cron result 1" <your email address>   <  /path-to-result1.txt
cron sends a mail containing the results of the script to the userid who owns the script.
Simon336697Author Commented:
Thanks guys!!

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now