Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Setup sendmail in RHEL 5.3 to use external SMTP

Posted on 2011-03-09
10
Medium Priority
?
2,860 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my‚Ķ
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates‚Ķ
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

618 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