?
Solved

Setup sendmail in RHEL 5.3 to use external SMTP

Posted on 2011-03-09
10
Medium Priority
?
2,848 Views
Last Modified: 2012-08-13
I am trying to setup sendmail in Red Hat Enterprise Linux to use an external SMTP. I have followed this steps:

1. Uncomment and change this line in /etc/mail/sendmail.mc as:
define(`SMART_HOST', `mailhost')

2. Add this line to /etc/hosts
10.30.128.4     mailhost

3. Compile settings
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

4. Restart sendmail service
service sendmail restart

Mail is not being delivered and I cannot figure out why. I have manually tested the external SMTP (using telnet mailhost 25, ..., rcpt to:...) and it works. So I am stuck at this point.

Could you please help me out with this one?

Any help would be very appreciated.
Regards
0
Comment
Question by:k3pa
[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
10 Comments
 
LVL 18

Expert Comment

by:TobiasHolm
ID: 35092512
Hi!

Have you tried to put brackets around the mailhost?

define(`SMART_HOST',`[mailhost]')dnl

Open in new window


Ref: http://www.linuxquestions.org/questions/slackware-14/sendmail-smtp-auth-howto-224543/#post1144343

Regards, Tobias
0
 
LVL 18

Expert Comment

by:TobiasHolm
ID: 35092524
Also, the IP 10.30.128.4 isn't a valid external IP, but that depends on how you define "external". It's not a routable IP on the internet.

Regards, Tobias
0
 
LVL 4

Author Comment

by:k3pa
ID: 35093010
I've tried to use this one:
define(`SMART_HOST',`[mailhost]')dnl

But nothing happens. The IP associated to mailhost is indeed within our private network but it's accesible. I don't have any trouble when sending mail throught it from the sendmail host.

Please find below the output from /var/log/maillog:

Mar 10 09:15:24 rhelserver sendmail[13482]: p2A8CKYx013482: from=root, size=56, class=0, nrcpts=1, msgid=<201103100812.p2A8CKYx013482@rhelserver.>, relay=root@localhost
Mar 10 09:15:24 rhelserver sendmail[13482]: p2A8CKYx013482: to=myemail@domain.com, delay=00:03:04, mailer=esmtp, pri=30056, dsn=4.4.3, stat=queued
0
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
LVL 29

Accepted Solution

by:
Jan Springer earned 2000 total points
ID: 35095265
The syntax uses a fully qualified domain name.  The DNS server that this machine is using should be able to resolve the FQDN into that IP:

From the Linux machine, what do you get when you type (substituting the domain name):

   host mailhost.domain.com

Configure:
 
   define(`SMART_HOST',`mailhost.domain.com')

And then:

    make -C /etc/mail
    service sendmail reload
0
 
LVL 4

Author Comment

by:k3pa
ID: 35126032
The host is not being resolved. Although the SMTP is whithin our corporate network, it's no so easy to add record to it because of the bureaucracy involved.

I will try to set up a local dns server to target the smtp server.
0
 
LVL 18

Expert Comment

by:TobiasHolm
ID: 35126670
You can try to add the "mailhost" host to the local /etc/hosts file.

Regards, Tobias
0
 
LVL 4

Assisted Solution

by:k3pa
k3pa earned 0 total points
ID: 35126897
I set up a dns server and names are being resolved ok.

> host mail.domain.com
mail.domain.com has has address 10.30.128.4

I also tested MX record:

> nslookup -query="MX" domain.com
Server:         10.30.128.81
Address:        10.30.128.81#53

domain.com  mail exchanger = 10 mail.domain.com.

I changed sendmail.cf like this:
DSmail.domain.com

However, emails are not sent. :(

Where shoud I do next?
0
 
LVL 18

Expert Comment

by:TobiasHolm
ID: 35126972
Can you see anything in the logs to help understand what's wrong?

Regards, Tobias
0
 
LVL 4

Author Comment

by:k3pa
ID: 35127081
Wow it's working now.

Setting up a DNS server with the MX host has worked. It's important to note that I am using the default sendmail.cf file. I will have to use this solution because I don't want to spend more time with this issue.

Thank you for your support.
Regards.
0
 
LVL 4

Author Closing Comment

by:k3pa
ID: 35170607
Fully qualified names and setting up a custom DNS server solved the issue.
0

Featured Post

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

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

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 …
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.
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month12 days, 2 hours left to enroll

752 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