Solved

Setup sendmail in RHEL 5.3 to use external SMTP

Posted on 2011-03-09
10
2,802 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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
 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Email signatures have numerous marketing benefits. Here are 8 top reasons to turn your email signature into a marketing channel.
Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
In this video we show how to create an email address policy 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 Mail Flow…
In this video we show how to create a mailbox database 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 >> Data…

777 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