Operating System - Linux
1820483 Members
2336 Online
109624 Solutions
New Discussion юеВ

Re: sendmail not relaying

 
SOLVED
Go to solution
Rick Garland
Honored Contributor

sendmail not relaying

Hi all:

Running with RH AS3.0 on an Intel.

Working with sendmail and trying to get it to relay to a Smart host. I set the DS variable to the name of the SMART HOST and then recycle the sendmail process - service sendmail restart.

It is still trying to send to localhost - doesn't go anywhere. What am I missing?

19 REPLIES 19
Steven E. Protter
Exalted Contributor
Solution

Re: sendmail not relaying

Standard tool run.

mailq

Is the mail queuing up or going to the bit bucket

sendmail -v -q interactively push the queue and get the error messages


sendmail -v -d8 -d38 someone@localhost
type some text

.


Pretty much get the same diags. The error message will be meaningful and can be acted upon for correction.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Celso Medina Kern
Trusted Contributor

Re: sendmail not relaying

Rick,

cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.copy

vi /etc/mail/sendmail.mc
set the line below without dnl at the begining:
define(`SMART_HOST',`atlsmtpx.hp.com')dnl

m4 /etc/mail/sendmail.mc \
> /etc/mail/sendmail.cf

It should now send emails trough your smart host, in my case atlsmtpx.nokia.com.

If you want your linux accept incomming emails from another host, REMOVE a line in sendmail.mc like this before running m4:
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')

If you have postfix(replacement for sendmail in RH) configured as your MTA, sendmail configuration won├В┬┤t make any effect.


Cel
God bless pessimists, they did the backup!
Celso Medina Kern
Trusted Contributor

Re: sendmail not relaying

Forgot,

After changing sendmail, of course there is a need for restarting:
# service sendmail restart
God bless pessimists, they did the backup!
Rick Garland
Honored Contributor

Re: sendmail not relaying

Here is a sample of what is happening when I try to send mail from my Linux system. The output below says that it is connecting to 127.0.0.1 instead of the SMART RELAY HOST that I defined in the sendmail.cf file using the DS variable and when I created a new sendmail.cf file using m4. Yes, service sendmail was stop/started/restarted. Why is it not using the SMART HOST as defined?


me@mydom.com... Connecting to [127.0.0.1] via relay...
220 mybox.mydom.com ESMTP Sendmail 8.12.10/8.12.10; Fri, 27 Aug 2004 08:50:46 -0600
>>> EHLO mybox.mydom.com
250-mybox.mydom.com Hello mybox.mydom.com [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH GSSAPI DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
>>> MAIL From: SIZE=12 AUTH=me@mybox.mydom.com
250 2.1.0 ... Sender ok
>>> RCPT To:
>>> DATA
250 2.1.5 ... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 i7REokbJ006098 Message accepted for delivery
myfirst.mylast@myotherdom.com... Sent (i7REokbJ006098 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 mybox.mydom.com closing connection


Celso Medina Kern
Trusted Contributor

Re: sendmail not relaying

Rick,

These sendmail stuff gets me crazy sometimes.

I remembered that you have to say what domains you allow RELAY in /etc/mail/access:

# Check the /usr/share/doc/sendmail/README.cf file for a description
# of the format of this file. (search for access_db in that file)
# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
# package.
#
# by default we allow relaying from localhost...
localhost.localdomain RELAY
localhost RELAY
127.0.0.1 RELAY
bra.mydomain.com RELAY

If this not help at all i can attach my sendmail.mc and cf for you to compare with.

Celso
God bless pessimists, they did the backup!
Steven E. Protter
Exalted Contributor

Re: sendmail not relaying

check the resultant sendmail.cf error.

Then see if your m4 script is working right.

Attaching example that WORKS.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Rick Garland
Honored Contributor

Re: sendmail not relaying

I am going brain dead on this. All I want to do is define a SMART HOST so that mail from my Linux system is relayed to the mail server and let it do the addressing and sending.

This linux system should do nothing more that send its locally generated mail to a mail server.

I have defined the SMART HOST in the sendmail.cf file, I have defined it in the sendmail.mc file and then use m4 to generate a new cf file. (And as always, restart service when changes happen).

Mail I send out from this Linux system is still connecting to 127.0.0.1 (itself) and the mail goes nowhere!

I can resolve forward and backwards.

I have setup, defined, and compiled mailertable with no difference in the relay.

I am missing something, but what?

Celso Medina Kern
Trusted Contributor

Re: sendmail not relaying

Two things about sendmail.mc:
FEATURE(`accept_unresolvable_domains')dnl
FEATURE(`relay_based_on_MX')dnl

these two lines cannot have dnl in the beggining.

Celso
God bless pessimists, they did the backup!
Rick Garland
Honored Contributor

Re: sendmail not relaying

they do not have dnl in front
Celso Medina Kern
Trusted Contributor

Re: sendmail not relaying

Compare with my sendmail.mc and see what can be wrong...

See also if relaying is allowed at all in /etc/mail/access as i mentioned above.

Celso
God bless pessimists, they did the backup!
Rick Garland
Honored Contributor

Re: sendmail not relaying

Got the relaying in the access.
Did a makemap hash /etc/mail/access.db < /etc/mail/access when I made changes. Right now the only entries in this file are my system name and localhost and 127.0.0.1. Need to be able to relay local mail from my system to the mail server. (I emphasize local mail - my system will not accept inbound mail, it only sends out, at least that is what I am trying to do)
Celso Medina Kern
Trusted Contributor

Re: sendmail not relaying

Other things i can recall:

- relay being resolved as localhost, ugly, but possible;

- mailertable configured;

- iptables redirection;

- ...stuck
God bless pessimists, they did the backup!
Rick Garland
Honored Contributor

Re: sendmail not relaying

Did a diff on your mc and mine.

A quick glance shows that most of the differences are because I am leaving the comments in my file.

I have attached the diff file

Jim Mallett
Honored Contributor

Re: sendmail not relaying

Rick,

This is kind of a step back from the other responses but just to be sure you have it covered.... Is there an entry for your SMART HOST in your /etc/hosts file. Have you checked basic connectivity with it, ie: ping?
Try doing a telnet to port 25 on the relay host and see what kind of a response you get. This way you can be sure your issue is based on your host and not something like the SMART HOST isn't accepting relays from you.

Jim
Hindsight is 20/20
Stuart Browne
Honored Contributor

Re: sendmail not relaying

Try putting square brackets around your smart-host, i.e.:

DEFINE(`SMART_HOST', `[my.relay.server]');

This prevents Sendmail trying to do it's usual A/MX lookup's to get the appropraite mail server for that name.
One long-haired git at your service...
Rick Garland
Honored Contributor

Re: sendmail not relaying

Have made some progress though I'm not sure how.

Sendmail mail from my Linux system is still connecting to 127.0.0.1 as seen by the verbose output. But now it is relaying that mail to the SMART HOST. It does not show this action (as seen in the verbose output of sendmail -v -d8.99 -d38.99) but it is getting there, somehow.

The mail is being received in my Exchange mailbox which is what I need.

Any ideas of why this is happening?

Many thanks to all!
Celso Medina Kern
Trusted Contributor

Re: sendmail not relaying

Rick,

It could be because MX records in DNS is saying who is the mailer exchanger for de destination domain.

Other crazy thing i could imagine is some redirection in your MTA(virtualusertable), or in Iptable, run iptable -L to see the security policy.

Perhaps your central mail was not accepting emails from your domain, and now someone has fixed that.

Sendmail will not accept mail for local delivery for hosts that are not specified by name in /etc/mail/local-host-names. If you included your smart host here, it is why it started to work(and you still have the smart relay not working as it is suposed to be)

Celso
God bless pessimists, they did the backup!
Jeff Hoevenaar
Frequent Advisor

Re: sendmail not relaying

make this change to the submit.mc/submit.cf file as well. The DSrelayserver.com line.

define(`SMART_HOST',`atlsmtpx.hp.com')dnl
Rick Garland
Honored Contributor

Re: sendmail not relaying

closed - thanks to all