?
Solved

Sending mail from linux through a relay host

Posted on 2004-08-17
4
Medium Priority
?
281 Views
Last Modified: 2013-12-06
I'm trying to send mail from Fedora Core 2 using "mail" command. The firewall policy does not allow this box to directly send mail out to the internet so I need to make use of the organizations MS Exchange server to relay mails through that box. The exchange server admin has given this box the rights to relay mail but how do I tell linux to send mails out / relay through exchange.

I'm trying to send mail from a shell script which basically notify me about certain tasks it runs.

Any help would be appreciated.

Thanks,
Ajit

0
Comment
Question by:a2k2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 11823424
Adding:

define(`SMART_HOST', `nochange.dom.tld')dnl

to /etc/mail/sendmail.mc (replacing nochange.dom.tld withthe FQDN of the exchange server) and restarting sendmail should do the trick. If you need to be able to deliver mail to exchange accounts you'l probably need to also:

define(`LUSER_RELAY', `nochange.dom.tld')dnl

So that mail to some-user@dom.tld that doesn't correspond to an account on the Linux box will be sent to the exchange server.
0
 

Author Comment

by:a2k2
ID: 11823515
Do I HAVE to use sendmail? I'm not running sendmail on this box. Can't I use something similar to 'mail' command? Something small and not complicated as sendmail?

Thanks again
Ajit
0
 
LVL 40

Accepted Solution

by:
jlevie earned 150 total points
ID: 11824335
'mail' is only the client application, what we refer to as a Mail User Agent (MUA). It can be used to read or to submit mail to a Mail Transport Agent (MTA) like Sendmail. Postfix, Qmail, etc. To actually get a message from 'mail' to some other system there must be a properly configured and operating MTA.

The default Sendmail configuration on Fedora prevents it from accepting mail from outside of the local machine, so there's no security or spam risk of it being enabled and active. And a number of things on a Linux/Unix system depend on a mail system being active on the system because they use mail for system notices (to root generally) and reports. So it's not a good idea to disable the mail system and one should check root's mail or forward it to an account you do check via the aliases map.
0
 

Author Comment

by:a2k2
ID: 11825790
Thank you jlevie. I'm now able to send mails through relay server.

Regards,
Ajit
0

Featured Post

Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
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…
Suggested Courses
Course of the Month10 days, 22 hours left to enroll

770 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