Send mail to users on another mail server

Posted on 2005-05-10
Last Modified: 2013-12-06
I have a Fedora 3 system with the default sendmail configuration. I would like to be able to send email from scripts on the linux machine to my regular company email. We have an exchange server. What do I need to set up to make this work?
Question by:m9s999
    LVL 16

    Accepted Solution

    I think that the easiest option may be to use the /etc/aliases file...

    in the script, suppose you want it to email 'doug' at your company, so the script has something like:
    mail -s "job results" doug < /root/jobresults

    (this grabs the jobresults file and emails it to 'doug' (doug@localhost.yourdomain))

    now, in the /etc/aliases file, add this line:
    doug:  <doug's real email address at your company>

    save the file, and execute 'newaliases'

    test from the command line:
    mail -s "testing" doug <ENTER>
    hi there <ENTER>

    then, have a look in /var/log/maillog to see if it's going out (I'm assuming that your sendmail server can do a DNS lookup to find your company domain....). I believe that Sendmail should let the email go out with the default settings. You could also configure a 'smart host' in Sendmail if your ISP will let you send email through them (or, if the Fedora machine is at work, set the Exchange server as your smart host!). That's done via


    Author Comment

    I added the smart host line and it works great. Thanks.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
    You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
    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.:
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

    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

    24 Experts available now in Live!

    Get 1:1 Help Now