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
Solved

Relay linux mail

Posted on 2013-10-24
9
454 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
  • 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

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

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to specify rdns for multi-homed mail server 5 60
AWS Central Authentication 1 86
cannot rename datastore 3 70
RHEL 6.7 Gnome Desktop on VMware 6 VM 9 66
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
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 …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
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.

840 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