?
Solved

Relay linux mail

Posted on 2013-10-24
9
Medium Priority
?
459 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
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

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…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

649 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