Solved

Relay linux mail

Posted on 2013-10-24
9
457 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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 485 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

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…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

689 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