Problem forwarding mail to another host on non-standard port

Problem forwarding mail to another host on non-standard port

am 13.01.2008 17:34:10 von ClarkVent

Hello all,

My mailserver receives all mail for one of my clients. But now it needs
to forward *most* mail to their exchange server. But their server is not
listening to the standard port 25 (because that's blocked by their ISP)
but to port 40025.

All mail for this client arrives at my mailserver addressed to
....@domain1.tld. It needs to be forwarded to servername.domain2.tld. Now
servername.domain2.tld simply points to the ip-address of their exchange
server and has no MX record (so it's something like a dyndns address).

I don't want to forward the entire domain1.tld, only specific users.

So this is what I did.

In sendmail.mc, I added a new mailer that connects to port 40025 on the
client:

Mesmtp40025, P=[IPC], F=mDFMuXa, S=EnvFromSMTP/HdrFromSMTP,
R=EnvToSMTP, E=\r\n, L=990, T=DNS/RFC822/SMTP, A=TCP $h 40025

I also added:

FEATURE(mailertable)

In virtusertable, I added:

user1@domain1.tld user1@servername.domain2.tld

In mailertable, I entered:

servername.domain2.tld esmtp40025:servername.domain2.tld

Testing the configuration with

sendmail -bv user1@domain1.tld

gives me:

user1@domain1.tld... deliverable: mailer esmtp40025,
host servername.domain2.tld, user user1@servername.domain2.tld

But when email arrives addressed to user1@domain1.tld, the mail is not
forwarded. Looking at my log file, I see this:

"sm-mta[23237]: m0DFxoOi023232: to=,
ctladdr= (1000/1000), delay=00:00:0
0, xdelay=00:00:00, mailer=esmtp40025, pri=120657,
relay=servername.domain2.tld. [xx.xx.xx.xx], dsn=5.7.1, stat=User unknown"

[xx.xx.xx.xx] is the correct IP address of servername.domain2.tld.

So what am I doing wrong?

Thanks,

Re: Problem forwarding mail to another host on non-standard port

am 13.01.2008 17:57:51 von Andrzej Filip

ClarkVent writes:

> Hello all,
>
> My mailserver receives all mail for one of my clients. But now it
> needs to forward *most* mail to their exchange server. But their
> server is not listening to the standard port 25 (because that's
> blocked by their ISP) but to port 40025.
>
> All mail for this client arrives at my mailserver addressed to
> ...@domain1.tld. It needs to be forwarded to
> servername.domain2.tld. Now servername.domain2.tld simply points to
> the ip-address of their exchange server and has no MX record (so it's
> something like a dyndns address).
>
> I don't want to forward the entire domain1.tld, only specific users.
>
> So this is what I did.
>
> In sendmail.mc, I added a new mailer that connects to port 40025 on
> the client:
>
> Mesmtp40025, P=[IPC], F=mDFMuXa, S=EnvFromSMTP/HdrFromSMTP,
> R=EnvToSMTP, E=\r\n, L=990, T=DNS/RFC822/SMTP, A=TCP $h 40025
>
> I also added:
>
> FEATURE(mailertable)
>
> In virtusertable, I added:
>
> user1@domain1.tld user1@servername.domain2.tld
>
> In mailertable, I entered:
>
> servername.domain2.tld esmtp40025:servername.domain2.tld
>
> Testing the configuration with
>
> sendmail -bv user1@domain1.tld
>
> gives me:
>
> user1@domain1.tld... deliverable: mailer esmtp40025,
> host servername.domain2.tld, user user1@servername.domain2.tld
>
> But when email arrives addressed to user1@domain1.tld, the mail is not
> forwarded. Looking at my log file, I see this:
>
> "sm-mta[23237]: m0DFxoOi023232: to=,
> ctladdr= (1000/1000), delay=00:00:0
> 0, xdelay=00:00:00, mailer=esmtp40025, pri=120657,
> relay=servername.domain2.tld. [xx.xx.xx.xx], dsn=5.7.1, stat=User
> unknown"
>
> [xx.xx.xx.xx] is the correct IP address of servername.domain2.tld.
>
> So what am I doing wrong?

You sendmail forwards the message to MS Exchange but MS Exchange gives
"user unknown" reply.

You may make sendmail
1) know all valid addresses accepted by MS Exchange
Keep them in some table - instruction posted many times
2) ask about email validity via LDAP query
There has been posted fresh example how to do it via
FEATURE(`ldap_routing')

I personally usually recommend option "1" to "mask" MS Exchange outages
(schedules and "unscheduled").

--
[pl>en: Andrew] Andrzej Adam Filip : anfi@priv.onet.pl : anfi@xl.wp.pl
Open-Sendmail: http://open-sendmail.sourceforge.net/
This novel is not to be tossed lightly aside, but to be hurled with great force.
-- Dorothy Parker
----
http://groups.google.com/groups?selm=87hchhfysw@clifford.fsf .hobby-site.com

Re: Problem forwarding mail to another host on non-standard port

am 13.01.2008 18:08:40 von ClarkVent

Thank you for your quick reply. :)

> You sendmail forwards the message to MS Exchange but MS Exchange gives
> "user unknown" reply.

So your saying my mailserver is actually forwarding properly, but their
server is the one responding with "Unknown user"? My client's network
administrator claims the user I'm forwarding mail to is "known". Also,
he says he sees in his log no connection is made to their exchange server.

Re: Problem forwarding mail to another host on non-standard port

am 13.01.2008 18:26:41 von Andrzej Filip

ClarkVent writes:

> Thank you for your quick reply. :)
>
>> You sendmail forwards the message to MS Exchange but MS Exchange gives
>> "user unknown" reply.
>
> So your saying my mailserver is actually forwarding properly, but
> their server is the one responding with "Unknown user"? My client's
> network administrator claims the user I'm forwarding mail to is
> "known". Also, he says he sees in his log no connection is made to
> their exchange server.

Send test message (as root) in verbose mode to get full trace of the
SMTP conversation. You can use modified "help script" below.

#!/bin/sh
#v+
###
# Set configuration variables
###
# email address of message recipient
RECIPIENT='user1@domain1.tld'
# email address of message sender
SENDER='user@example.com'
# current date in RFC822 format
DATE=`date -R`

###
# Send test message in verbose mode
# -Am - skip sending to 127.0.0.1:25, send directly
# -v - be verbose (track SMTP conversation)
# -oi - do not treat single dot line as end of message
# -f - set envelope sender address
# -- - separate arguments from recipient addresses
###
/usr/sbin/sendmail -Am -v -oi -f$SENDER -- $RECIPIENT < From: $SENDER
To: $RECIPIENT
Subject: delivery test

delivery test: $DATE
END
###
# THE END
###
#v-

--
[pl>en: Andrew] Andrzej Adam Filip : anfi@priv.onet.pl : anfi@xl.wp.pl
Open-Sendmail: http://open-sendmail.sourceforge.net/
We reject: kings, presidents, and voting.
We believe in: rough consensus and working code.
-- Dave Clark
----
http://groups.google.com/groups?selm=87y7ateiwe@andre.fsf.ho bby-site.com

Re: Problem forwarding mail to another host on non-standard port

am 13.01.2008 21:19:02 von ClarkVent

Again, thank you for your quick reply.

I never thought about sending a test message in verbose mode - duh! But
I just did and it confirms you are right and the message is indeed
delivered at the Exchange Server - and it replies the user does not exist.

Thank you for your help!

Andrzej Adam Filip wrote:
> ClarkVent writes:
>
>> Thank you for your quick reply. :)
>>
>>> You sendmail forwards the message to MS Exchange but MS Exchange gives
>>> "user unknown" reply.
>> So your saying my mailserver is actually forwarding properly, but
>> their server is the one responding with "Unknown user"? My client's
>> network administrator claims the user I'm forwarding mail to is
>> "known". Also, he says he sees in his log no connection is made to
>> their exchange server.
>
> Send test message (as root) in verbose mode to get full trace of the
> SMTP conversation. You can use modified "help script" below.
>
> #!/bin/sh
> #v+
> ###
> # Set configuration variables
> ###
> # email address of message recipient
> RECIPIENT='user1@domain1.tld'
> # email address of message sender
> SENDER='user@example.com'
> # current date in RFC822 format
> DATE=`date -R`
>
> ###
> # Send test message in verbose mode
> # -Am - skip sending to 127.0.0.1:25, send directly
> # -v - be verbose (track SMTP conversation)
> # -oi - do not treat single dot line as end of message
> # -f - set envelope sender address
> # -- - separate arguments from recipient addresses
> ###
> /usr/sbin/sendmail -Am -v -oi -f$SENDER -- $RECIPIENT < > From: $SENDER
> To: $RECIPIENT
> Subject: delivery test
>
> delivery test: $DATE
> END
> ###
> # THE END
> ###
> #v-
>

Re: Problem forwarding mail to another host on non-standard port

am 13.01.2008 21:46:16 von Andrzej Filip

ClarkVent writes:
> Andrzej Adam Filip wrote:
>> ClarkVent writes:
>>> Andrzej Adam Filip wrote:
>>>> Your sendmail forwards the message to MS Exchange but MS Exchange
>>>> gives "user unknown" reply.
>>> So your saying my mailserver is actually forwarding properly, but
>>> their server is the one responding with "Unknown user"? My client's
>>> network administrator claims the user I'm forwarding mail to is
>>> "known". Also, he says he sees in his log no connection is made to
>>> their exchange server.
>>
>> Send test message (as root) in verbose mode to get full trace of the
>> SMTP conversation. You can use modified "help script" below.
>>
>> #!/bin/sh
>> [...]
>
> I never thought about sending a test message in verbose mode - duh!
> But I just did and it confirms you are right and the message is indeed
> delivered at the Exchange Server - and it replies the user does not
> exist.

You have learned one more trick useful to gather "*hard* evidence".

P.S.
0) It is a pleasure to help "correct" postmaster of MS Exchange ;-)
1) Experience makes you use a lot of tricks that *look* simple :-)

--
[pl>en: Andrew] Andrzej Adam Filip : anfi@priv.onet.pl : anfi@xl.wp.pl
Open-Sendmail: http://open-sendmail.sourceforge.net/
In my experience, if you have to keep the lavatory door shut by extending
your left leg, it's modern architecture.
-- Nancy Banks Smith
----
http://groups.google.com/groups?selm=877iidcv3b@john.fsf.hob by-site.com