System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Mailing directly to host: Square brackets no longer work?

SOLVED
Go to solution
Mark_Tunnell
Occasional Contributor

Mailing directly to host: Square brackets no longer work?

In earlier versions of Sendmail you used to be able to enclose the destination hostname or IP in square brackets [ ] and this would bypass the MX lookup and send the message directly to the host. Ex. echo "testing" | mail testuser@[192.168.1.1]

This still works on a test system running Sendmail 8.9. However it does not work on 8.11.1 or 8.13.4, two other versions I'm testing with, instead it always forwards to the "Smart" relay host.

Does anybody know a way to bypass MX and Smart host and send directly to a host using more recent Sendmail versions?

Thanks.
3 REPLIES
Mel Burslan
Honored Contributor
Solution

Re: Mailing directly to host: Square brackets no longer work?

I have 2 servers on the same subnet running v8.11.1 and I can do this here are the details:

$ what /usr/sbin/sendmail
/usr/sbin/sendmail:
Copyright (c) 1998 HEWLETT PACKARD COMPANY and its licensors,
including Sendmail, Inc., and the Regents of the
University of California. All rights reserved.
version.c 8.11.1 (Berkeley) - Revision 1.5 - 2003/05/05

$ echo test | /usr/sbin/sendmail -v dummy@[X.Y.66.71]
dummy@[X.Y.66.71]... Connecting to [X.Y.66.71] via esmtp...
220 destination.mydomain.com ESMTP Sendmail 8.11.1 (Revision 1.5) /8.9.3; Thu, 4 Jun 2009 09:14:14 -0700 (PDT)
>>> EHLO source.mydomain.com
250-destination.mydomain.com Hello source.mydomain.com [X.Y.66.72], pleased to meet you
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-SIZE
250-DSN
250-ONEX
250-ETRN
250-XUSR
250 HELP
>>> MAIL From: SIZE=5
250 2.1.0 ... Sender ok
>>> RCPT To:
250 2.1.5 ... Recipient ok
>>> DATA
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 n54GEEs25547 Message accepted for delivery
dummy@[X.Y.66.71]... Sent (n54GEEs25547 Message accepted for delivery)
Closing connection to [X.Y.66.71]
>>> QUIT
221 2.0.0 destination.mydomain.com closing connection


(sorry about the obliteration of hostnames and IP addresses but this is the actual transcript of mail exchange)
________________________________
UNIX because I majored in cryptology...
Mark_Tunnell
Occasional Contributor

Re: Mailing directly to host: Square brackets no longer work?

Cool! Thank you.

That tells me it must be a configuration issue and not the Sendmail version itself since when I do the same thing on the same version it forces it to the Smart host.

Any ideas what or where that configuration setting might be? I've looked through the .cf file but didn't see anything that appears to control this behavior.

$ what /usr/sbin/sendmail
/usr/sbin/sendmail:
$Revision: 92453-07 linker linker crt0.o B.11.16.01 030415 $
Copyright (c) 1998 HEWLETT PACKARD COMPANY and its licensors,
including Sendmail, Inc., and the Regents of the
University of California. All rights reserved.
version.c 8.11.1 (Berkeley) - 01 December 2006 (PHNE_35485)
$ echo test | /usr/sbin/sendmail -v testuser@[x.x.25.115]
testuser@[x.x.25.115]... Connecting to systemalertsrelay.x.org. via esmtp...
Mel Burslan
Honored Contributor

Re: Mailing directly to host: Square brackets no longer work?

if you are traversing through a firewall, the firewall rules might be directing traffic to port 25, directly to the mail server. I have a DS defined in my sendmail.cf but when I use the square brackets it does not use the relay server.

One thing I noticed, it might be by design, if I put the hostname instead of the ip address in the brackets, it connects to the destination but I get a "relaying refused" message, even though the hostname I put there resolves directly to the IP{ address I used while sending the message successfully. So, the square brackets might be something more than a directive to bypass the relay. Not a big sendmail fan here, to be perfectly honest.
________________________________
UNIX because I majored in cryptology...