[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

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

Send mail to users on another mail server

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?
1 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 sendmail.mc...

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

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

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