Solved

Setup sendmail in RHEL 5.3 to use external SMTP

Posted on 2011-03-09
10
2,794 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
  • 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
 
LVL 28

Accepted Solution

by:
Jan Springer earned 500 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Want to promote your upcoming event?

Attending an event? Speaking at a conference? Or exhibiting at a trade show? Easily inform your contacts by using a promotional banner in your email signature. This will ensure your organization’s most important contacts are in the know.

Question has a verified solution.

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

Easy CSR creation in Exchange 2007,2010 and 2013
Fine Tune your automatic Updates for Ubuntu / Debian
In this video we show how to create a Contact 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 Recipients >> Contact ta…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager

863 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

24 Experts available now in Live!

Get 1:1 Help Now