?
Solved

Relay linux mail

Posted on 2013-10-24
9
Medium Priority
?
458 Views
Last Modified: 2013-11-11
We have migrated our company's email to office365. I have a linux machine that sends email to different individuals. We have setup a mail relay server, as it was suggested. All other window machines and copiers, that sends email, now works because of the relay server. I need help to what needs to be changed on linux, to use the relay server. Thanks in advance.
0
Comment
Question by:rsolomon
[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
  • 5
  • 4
9 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39598133
Just configure a SMART_HOST on the affected Linux machines.

Edit /etc/mail/sendmail.mc (Attention: Some Linuxes call this file "linux.mc"!) and add just above the line containing "MAILER_DEFINITIONS" or starting with "MAILER(...":

define(`SMART_HOST', smtp:myrelay.tld)dnl

where myrelay.tld stands for the  fully qualified name of your mail relay server.

Now create as root (or using "sudo") sendmail.cf from sendmail.mc:

cd /etc/mail
m4 sendmail.mc > sendmail.cf

Restart the sendmail service as root (or using "sudo"):

/etc/init.d/sendmail restart

This should do the trick if no authentication against the relay server is needed.

Should authentication be required please let me know, I'll show you the additional steps.

wmp
0
 

Author Comment

by:rsolomon
ID: 39598232
I don't see "MAILER_DEFINITIONS". However, I see dnl define(`SMART_HOST', `smtp.your.provider')dnl. Do I keep the quotes, or not? I kept the quotes. when I run
m4 sendmail.mc > sendmail.cf

as root, I get:

[root@dbrac01 mail]# m4 sendmail.mc > sendmail.cf
sendmail.mc:10: m4: cannot open `/usr/share/sendmail-cf/m4/cf.m4': No such file or directory

Any idea?
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39598286
1.

The quotes must be kept as they are in the sample you posted (  ` '  pairs). Sorry, I missed to put them around the hostname in my comment!

To activate the definition please remove "dnl " in front of "define".
"dnl" at the end of the line must remain there!

2.

You're obviously missing one or more sendmail packages, particularly the "sendmail-cf" package. Please install it using the installer pertaining to your system (yum, rpm, apt-get, ...), e.g.:

yum install sendmail-cf

apt-get  install sendmail-cf
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:rsolomon
ID: 39598364
Made the change. If I'm missing some packages, how am I sending email? If m4 is only recreating sendmail.cf, can I just change sendmail.cf and restart sendmail?
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39598389
>> How am I sending email? <<

You're missing the "configure" package, not the package containing the sendmail binaries and the digested config.

And yes, you can modify sendmail.cf without going through the macros (that's unusual for Linux, yet quite common for e.g. AIX).

Edit /etc/mail/sendmail.cf and locate the line starting with "DS ". Change to

DSmyrelay.tld

where myrelay.tld stands for the fully qualified relay hostname.

If you want to relay ALL outgoing mail (not just the mail going outside your local domain) change the DH ("Mail Hub") line instead. Attention: In this case the mail hub must be in your local domain!

Restart the sendmail service as described above.
0
 

Author Comment

by:rsolomon
ID: 39598713
Does these changes affect only the sendmail client or all clients that sends mail. (i.e. mutt)?
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39598729
All clients which use sendmail(.cf). Mutt is among them, but afaik most others are as well.
0
 

Author Comment

by:rsolomon
ID: 39599499
Is there a place to put the port of the relay server?
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 1940 total points
ID: 39599924
Yes.

In sendmail.cf find "Mrelay, ", then add the non standard port number (example: 587) after "$h", like

Mrelay,         P=[IPC], F=mDFMuXa8, S=EnvFromSMTP/HdrFromSMTP, R=MasqSMTP, E=\r\n, L=2040,
                T=DNS/RFC822/SMTP,
                A=TCP $h 587

Open in new window

0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month10 days, 11 hours left to enroll

764 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