Solved

Relay linux mail

Posted on 2013-10-24
9
451 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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded‚Ķ
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
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.:
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.

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now