Sending mail to admins from Linux

Posted on 2005-04-08
Last Modified: 2010-04-20
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.

Question by:Simon336697
    LVL 38

    Accepted Solution

    > 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
    LVL 16

    Assisted Solution

    cron sends a mail containing the results of the script to the userid who owns the script.
    LVL 1

    Author Comment

    Thanks guys!!

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
    The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now