You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Tim Stephenson <ti...@thestephensons.me.uk> on 2003/05/24 17:48:42 UTC

[PATCH] Re: multiple gateways possible?

Here is the patch to allow multiple gateway tags we have been discussing. I
have assumed that the gatewayPort tag will be deprecated and said so in a
comment in the code. However if
    a) the port is specified and
    b) there is exactly one gateway specified
then the port is concatenated to the URLName used to connect like this
        smtp://<gateway string>:<gateway port string>
which seems both logical and works for explicitly naming port 25 (I have not
tested with non-standard ports).

I did not modify the code to use one of the alternative constructors for
URLName since this way would allow the gatewy tag to be (ab)used to specify
such things as username and password if so desired.

Tim

RCS file:
/home/cvspublic/jakarta-james/src/java/org/apache/james/transport/mailets/Re
moteDelivery.java,v
retrieving revision 1.48
diff -w -b -r1.48 RemoteDelivery.java
73a74
> import java.util.StringTokenizer;
132c133
<     private String gatewayPort = null;  //the port of the gateway server
to send all email to
---
>     private String gatewayPort = null;  //the port of the gateway server
to send all email to, deprecated, include port in gateway as <host>:<port>
259c260,273
<                 targetServers.add(gatewayServer);
---
>                 StringTokenizer st = new StringTokenizer(gatewayServer,
",") ;
>                 while (st.hasMoreTokens()) {
>                     String server = st.nextToken().trim() ;
>
>                     // For backwards compatibility, if have just one
gateway AND a gateway port
>                     // then concatenate the port to this host - otherwise
ignore
>                     if (gatewayPort != null && !st.hasMoreTokens()) {
>                         server += ":";
>                         server += gatewayPort;
>                     }
>
>                     if (isDebug) log("Adding SMTP gateway: " + server) ;
>                     targetServers.add(server);
>                 }
299c313
<                             // Any error on connect should cause the
mailet to attempt
---
>                             // Any error on connect (or send) should cause
the mailet to attempt
339a354,362
>                     } else if (me.getNextException() != null &&
>                             me.getNextException().getMessage() != null &&
>
me.getNextException().getMessage().indexOf("550") > -1) {
>                         // When using multiple gateways on different
networks,
>                         // this is the exception that occurs trying to
relay on a
>                         // gateway you are not currently entitled to, as
such we should
>                         // continue with other servers in the list
>                         lastError = me;
>                         continue;
713,717d735
<         }
<
<         //If there's a gateway port, we can just set it here
<         if (gatewayPort != null) {
<             props.put("mail.smtp.port", gatewayPort);



---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


Re: -u style diff guide (was Re: [PATCH] Re: multiple gateways possible?)

Posted by Tetsuya Kitahata <te...@nifty.com>.
Hi,

> > Where should I put this guide to??
> 
> Take a look at http://www.apache.org/dev/contributors.html, which we should
> probably link to for people.  That would be the appropriate place, in my
> view.

Thank you for the information, Noel.
For sure, this is appropriate, reasonable place for it.

Sincerely,

--
Tetsuya Kitahata <te...@nifty.com>


---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


RE: -u style diff guide (was Re: [PATCH] Re: multiple gateways possible?)

Posted by "Noel J. Bergman" <no...@devtech.com>.
> Where should I put this guide to??

Take a look at http://www.apache.org/dev/contributors.html, which we should
probably link to for people.  That would be the appropriate place, in my
view.

	--- Noel

-----Original Message-----
From: Tetsuya Kitahata [mailto:tetsuya.kitahata@nifty.com]
Sent: Sunday, May 25, 2003 0:57
To: James Developers List
Subject: -u style diff guide (was Re: [PATCH] Re: multiple gateways
possible?)


Hi,

> Please see http://james.apache.org/contribute.html for the proper way to
> submit a patch.  This one was not run with -u, and was embedded in a
> message, thus corrupting its contents.  Please resubmit.  Thanks.  :-)

I once made a guide how to create -u style diff (unified diff) on WinCVS
(for jakarta-poi and jakarta-commons .. ) for Windows users.

----------------------------------------------------------------------
  <p>
  <strong>Note:</strong></p>
  <p>If you use <a href='http://www.wincvs.org/'>WinCVS</a>, move to
  <code>[Admin]</code> -&gt; <code>[Command Line]</code> Menu and type
<code>cvs diff -u</code> at
  <code>[Enter a cvs line command]</code> input field (<code>[Commandline
Settings] Tab</code>),
  while selecting the target directories or files, in order to create
unified
diffs. </p>
  <p>In other words,
<code>[Alt+A]</code>+<code>[Alt+C]</code>+<code>[Alt+C]</code>
  and type <code>cvs diff -u</code>.
  </p>
  <p>Also, by adding the name of WinCVS-Installed directory to
&quot;path&quot; environment variables, you can use &quot;cvs diff&quot;
command on the checked-out directory (like <code>cvs diff -u >
foo.diff</code>) recursively via MS-DOS command prompt.
  </p>
----------------------------------------------------------------------

Where should I put this guide to??

Regards,
Tetsuya.

-----------------------------------------------------
Tetsuya Kitahata --  Terra-International, Inc.
E-mail: kitahata@bb.mbn.or.jp
http://www.terra-intl.com/
(Apache Jakarta Japanese Translation) http://jakarta.terra-intl.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


-u style diff guide (was Re: [PATCH] Re: multiple gateways possible?)

Posted by Tetsuya Kitahata <te...@nifty.com>.
Hi,

> Please see http://james.apache.org/contribute.html for the proper way to
> submit a patch.  This one was not run with -u, and was embedded in a
> message, thus corrupting its contents.  Please resubmit.  Thanks.  :-)

I once made a guide how to create -u style diff (unified diff) on WinCVS
(for jakarta-poi and jakarta-commons .. ) for Windows users.

----------------------------------------------------------------------
  <p>
  <strong>Note:</strong></p>
  <p>If you use <a href='http://www.wincvs.org/'>WinCVS</a>, move to 
  <code>[Admin]</code> -&gt; <code>[Command Line]</code> Menu and type <code>cvs diff -u</code> at 
  <code>[Enter a cvs line command]</code> input field (<code>[Commandline Settings] Tab</code>), 
  while selecting the target directories or files, in order to create  unified
diffs. </p>
  <p>In other words, <code>[Alt+A]</code>+<code>[Alt+C]</code>+<code>[Alt+C]</code> 
  and type <code>cvs diff -u</code>.
  </p>
  <p>Also, by adding the name of WinCVS-Installed directory to
&quot;path&quot; environment variables, you can use &quot;cvs diff&quot;
command on the checked-out directory (like <code>cvs diff -u >
foo.diff</code>) recursively via MS-DOS command prompt.
  </p>
----------------------------------------------------------------------

Where should I put this guide to??

Regards,
Tetsuya.

-----------------------------------------------------
Tetsuya Kitahata --  Terra-International, Inc.
E-mail: kitahata@bb.mbn.or.jp
http://www.terra-intl.com/
(Apache Jakarta Japanese Translation) http://jakarta.terra-intl.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


Coding standards for James

Posted by "Noel J. Bergman" <no...@devtech.com>.
> > Please see http://james.apache.org/contribute.html
> > for the proper way to submit a patch.

> There didn't appear to be rules about the file format
> for the attachment, I used Unix style end of lines.

See: http://james.apache.org/code-standards.html  :-)

	--- Noel

---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


RE: [PATCH] (inc new doc patch) Re: multiple gateways possible?

Posted by "Noel J. Bergman" <no...@devtech.com>.
> Looks like this is working!

:-)

> I had expected 550 wrapped as you described but did not get it so far.

If you look further down in the loop, you'll see where we pick up on 5xx
responses.  When we get them the assumption is that if it occurs on one
server, it would occur on all.  In fact, the same assumption is made
regarding 4xx -- we don't try another server in the list, we queue the
message for retrying later.

Someday someone will have time to rewrite RemoteDelivery to address these
(and other) issues.  But it won't be me any time soon.  :-)

> I haven't a clue about how the send partial is affected

Read the comments and code in the catch clause for SendFailedException.

	--- Noel


---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


Re: [PATCH] (inc new doc patch) Re: multiple gateways possible?

Posted by Tim Stephenson <ti...@thestephensons.me.uk>.
Noel,

Looks like this is working! I had expected 550 wrapped as you described but
did not get it so far. I'll try a few more tests with some different hosts
as soon as I can since I suspect the success is down to some flakey configs
allowing relaying when they shouldn't.

To be honest I haven't a clue about how the send partial is affected so at
this stage I don't understand what is 'not correct' so I'll need to look
into that more.

Attached is a patch to the doco explaining the new tags' behaviour.

Tim
----- Original Message -----
From: "Noel J. Bergman" <no...@devtech.com>
To: "James Developers List" <ja...@jakarta.apache.org>
Sent: Tuesday, May 27, 2003 3:48 AM
Subject: RE: [PATCH] Re: multiple gateways possible?


> Tim,
>
> I reviewed this patch, and have incorporated a revision for testing into
the
> CVS for James v2.  Please note that I did NOT incorporate the 550 check.
> Primarily I did not do so because I am not convinced that the 550 as
> presented would not interact quite badly with send partial.  It seems to
me
> that 550 responses are going to come back packaged in a
SendFailedException.
> The current code was handling the special case of an IOException wrapped
in
> a MessagingException.
>
> I am not saying that the idea of going to another server in the case were
> one server in a set of possible addresses rejects a recipient isn't
> reasonable, but the execution of that idea in this patch does not appear
to
> be correct.
>
> The patch being posted also includes a requested change related to not
> incrementing the error count for each server, but rather incrementing the
> error count for each PASS through a set of servers.
>
> I tested these changes using the following configuration:
>
>   <mailet match="All" class="RemoteDelivery">
>      <outgoing> file://var/mail/gateway/ </outgoing>
>      <delayTime> 21600000 </delayTime>
>      <maxRetries> 5 </maxRetries>
>      <deliveryThreads> 5 </deliveryThreads>
>      <gateway>192.168.1.1</gateway>
>      <gateway>192.168.1.1:2525</gateway>
>      <gateway>192.168.1.1:2526</gateway>
>      <gatewayPort>25</gatewayPort>
>      <debug>true</debug>
>   </mailet>
>
> And logged the behavior as I incrementally shutdown all of the gateways,
and
> then brought one back up.
>
> PLEASE review the changes that I made.  I'm also going to commit them to
> HEAD in a few minutes.
>
> --- Noel
>
> -----Original Message-----
> From: Tim Stephenson [mailto:tim@thestephensons.me.uk]
> Sent: Saturday, May 24, 2003 13:57
> To: James Developers List
> Subject: [PATCH] Re: multiple gateways possible?
>
>
> OK let's try that again (attached). There didn't appear to be rules about
> the file format for the attachment, I used Unix style end of lines.
>
> About the 550 check: I included this in an attempt to minimise the change
in
> behaviour. If it is not there any failure that is not an IOException is
> deemed to apply to all servers in the gateway list so they are not tried.
> Since the exact reason for the failure appear not to be well understood
(at
> least by me) or are just broken as in your Notes example. I would prefer
to
> try all servers in the list in all failure cases, what do you think?
> Obviously this incurs a performance penalty in cases when the failure _is_
> for a more generalised reason, which is presumably why the code is as it
is.
>
> Tim
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
>

RE: [PATCH] 550 handling (WAS multiple gateways possible?)

Posted by "Noel J. Bergman" <no...@devtech.com>.
Tim,

Have you tested it?

	--- Noel

-----Original Message-----
From: Tim Stephenson [mailto:tim@thestephensons.me.uk]
Sent: Thursday, June 05, 2003 8:51
To: James Developers List
Subject: [PATCH] 550 handling (WAS multiple gateways possible?)


this patch still avoids reporting a perm error until all servers have been
tried UNLESS a partial send occurs in which case the error is processed as
previously


---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


[PATCH] 550 handling (WAS multiple gateways possible?)

Posted by Tim Stephenson <ti...@thestephensons.me.uk>.
this patch still avoids reporting a perm error until all servers have been
tried UNLESS a partial send occurs in which case the error is processed as
previously

Re: [PATCH] 550 handling (WAS multiple gateways possible?)

Posted by Tim Stephenson <ti...@thestephensons.me.uk>.
Ok let me withdraw that whilst I think about it a bit harder.
----- Original Message -----
From: "Tim Stephenson" <ti...@thestephensons.me.uk>
To: "James Developers List" <ja...@jakarta.apache.org>
Sent: Thursday, June 05, 2003 12:46 PM
Subject: [PATCH] 550 handling (WAS multiple gateways possible?)


> I took another look at this issue and this time understood what you were
> getting at about the SendFailedException Noel.
>
> here is another patch aimed at allowing the use of other configured
servers
> in the event that one rejects a relay.
>
> Tim
> ----- Original Message -----
> From: "Noel J. Bergman" <no...@devtech.com>
> To: "James Developers List" <ja...@jakarta.apache.org>
> Sent: Tuesday, May 27, 2003 3:48 AM
> Subject: RE: [PATCH] Re: multiple gateways possible?
>
>
> > Tim,
> >
> > I reviewed this patch, and have incorporated a revision for testing into
> the
> > CVS for James v2.  Please note that I did NOT incorporate the 550 check.
> > Primarily I did not do so because I am not convinced that the 550 as
> > presented would not interact quite badly with send partial.  It seems to
> me
> > that 550 responses are going to come back packaged in a
> SendFailedException.
> > The current code was handling the special case of an IOException wrapped
> in
> > a MessagingException.
> >
> > I am not saying that the idea of going to another server in the case
were
> > one server in a set of possible addresses rejects a recipient isn't
> > reasonable, but the execution of that idea in this patch does not appear
> to
> > be correct.
> >
> > The patch being posted also includes a requested change related to not
> > incrementing the error count for each server, but rather incrementing
the
> > error count for each PASS through a set of servers.
> >
> > I tested these changes using the following configuration:
> >
> >   <mailet match="All" class="RemoteDelivery">
> >      <outgoing> file://var/mail/gateway/ </outgoing>
> >      <delayTime> 21600000 </delayTime>
> >      <maxRetries> 5 </maxRetries>
> >      <deliveryThreads> 5 </deliveryThreads>
> >      <gateway>192.168.1.1</gateway>
> >      <gateway>192.168.1.1:2525</gateway>
> >      <gateway>192.168.1.1:2526</gateway>
> >      <gatewayPort>25</gatewayPort>
> >      <debug>true</debug>
> >   </mailet>
> >
> > And logged the behavior as I incrementally shutdown all of the gateways,
> and
> > then brought one back up.
> >
> > PLEASE review the changes that I made.  I'm also going to commit them to
> > HEAD in a few minutes.
> >
> > --- Noel
> >
> > -----Original Message-----
> > From: Tim Stephenson [mailto:tim@thestephensons.me.uk]
> > Sent: Saturday, May 24, 2003 13:57
> > To: James Developers List
> > Subject: [PATCH] Re: multiple gateways possible?
> >
> >
> > OK let's try that again (attached). There didn't appear to be rules
about
> > the file format for the attachment, I used Unix style end of lines.
> >
> > About the 550 check: I included this in an attempt to minimise the
change
> in
> > behaviour. If it is not there any failure that is not an IOException is
> > deemed to apply to all servers in the gateway list so they are not
tried.
> > Since the exact reason for the failure appear not to be well understood
> (at
> > least by me) or are just broken as in your Notes example. I would prefer
> to
> > try all servers in the list in all failure cases, what do you think?
> > Obviously this incurs a performance penalty in cases when the failure
_is_
> > for a more generalised reason, which is presumably why the code is as it
> is.
> >
> > Tim
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: james-dev-help@jakarta.apache.org
> >
>


----------------------------------------------------------------------------
----


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


[PATCH] 550 handling (WAS multiple gateways possible?)

Posted by Tim Stephenson <ti...@thestephensons.me.uk>.
I took another look at this issue and this time understood what you were
getting at about the SendFailedException Noel.

here is another patch aimed at allowing the use of other configured servers
in the event that one rejects a relay.

Tim
----- Original Message -----
From: "Noel J. Bergman" <no...@devtech.com>
To: "James Developers List" <ja...@jakarta.apache.org>
Sent: Tuesday, May 27, 2003 3:48 AM
Subject: RE: [PATCH] Re: multiple gateways possible?


> Tim,
>
> I reviewed this patch, and have incorporated a revision for testing into
the
> CVS for James v2.  Please note that I did NOT incorporate the 550 check.
> Primarily I did not do so because I am not convinced that the 550 as
> presented would not interact quite badly with send partial.  It seems to
me
> that 550 responses are going to come back packaged in a
SendFailedException.
> The current code was handling the special case of an IOException wrapped
in
> a MessagingException.
>
> I am not saying that the idea of going to another server in the case were
> one server in a set of possible addresses rejects a recipient isn't
> reasonable, but the execution of that idea in this patch does not appear
to
> be correct.
>
> The patch being posted also includes a requested change related to not
> incrementing the error count for each server, but rather incrementing the
> error count for each PASS through a set of servers.
>
> I tested these changes using the following configuration:
>
>   <mailet match="All" class="RemoteDelivery">
>      <outgoing> file://var/mail/gateway/ </outgoing>
>      <delayTime> 21600000 </delayTime>
>      <maxRetries> 5 </maxRetries>
>      <deliveryThreads> 5 </deliveryThreads>
>      <gateway>192.168.1.1</gateway>
>      <gateway>192.168.1.1:2525</gateway>
>      <gateway>192.168.1.1:2526</gateway>
>      <gatewayPort>25</gatewayPort>
>      <debug>true</debug>
>   </mailet>
>
> And logged the behavior as I incrementally shutdown all of the gateways,
and
> then brought one back up.
>
> PLEASE review the changes that I made.  I'm also going to commit them to
> HEAD in a few minutes.
>
> --- Noel
>
> -----Original Message-----
> From: Tim Stephenson [mailto:tim@thestephensons.me.uk]
> Sent: Saturday, May 24, 2003 13:57
> To: James Developers List
> Subject: [PATCH] Re: multiple gateways possible?
>
>
> OK let's try that again (attached). There didn't appear to be rules about
> the file format for the attachment, I used Unix style end of lines.
>
> About the 550 check: I included this in an attempt to minimise the change
in
> behaviour. If it is not there any failure that is not an IOException is
> deemed to apply to all servers in the gateway list so they are not tried.
> Since the exact reason for the failure appear not to be well understood
(at
> least by me) or are just broken as in your Notes example. I would prefer
to
> try all servers in the list in all failure cases, what do you think?
> Obviously this incurs a performance penalty in cases when the failure _is_
> for a more generalised reason, which is presumably why the code is as it
is.
>
> Tim
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
>

RE: [PATCH] Re: multiple gateways possible?

Posted by "Noel J. Bergman" <no...@devtech.com>.
Tim,

I reviewed this patch, and have incorporated a revision for testing into the
CVS for James v2.  Please note that I did NOT incorporate the 550 check.
Primarily I did not do so because I am not convinced that the 550 as
presented would not interact quite badly with send partial.  It seems to me
that 550 responses are going to come back packaged in a SendFailedException.
The current code was handling the special case of an IOException wrapped in
a MessagingException.

I am not saying that the idea of going to another server in the case were
one server in a set of possible addresses rejects a recipient isn't
reasonable, but the execution of that idea in this patch does not appear to
be correct.

The patch being posted also includes a requested change related to not
incrementing the error count for each server, but rather incrementing the
error count for each PASS through a set of servers.

I tested these changes using the following configuration:

  <mailet match="All" class="RemoteDelivery">
     <outgoing> file://var/mail/gateway/ </outgoing>
     <delayTime> 21600000 </delayTime>
     <maxRetries> 5 </maxRetries>
     <deliveryThreads> 5 </deliveryThreads>
     <gateway>192.168.1.1</gateway>
     <gateway>192.168.1.1:2525</gateway>
     <gateway>192.168.1.1:2526</gateway>
     <gatewayPort>25</gatewayPort>
     <debug>true</debug>
  </mailet>

And logged the behavior as I incrementally shutdown all of the gateways, and
then brought one back up.

PLEASE review the changes that I made.  I'm also going to commit them to
HEAD in a few minutes.

	--- Noel

-----Original Message-----
From: Tim Stephenson [mailto:tim@thestephensons.me.uk]
Sent: Saturday, May 24, 2003 13:57
To: James Developers List
Subject: [PATCH] Re: multiple gateways possible?


OK let's try that again (attached). There didn't appear to be rules about
the file format for the attachment, I used Unix style end of lines.

About the 550 check: I included this in an attempt to minimise the change in
behaviour. If it is not there any failure that is not an IOException is
deemed to apply to all servers in the gateway list so they are not tried.
Since the exact reason for the failure appear not to be well understood (at
least by me) or are just broken as in your Notes example. I would prefer to
try all servers in the list in all failure cases, what do you think?
Obviously this incurs a performance penalty in cases when the failure _is_
for a more generalised reason, which is presumably why the code is as it is.

Tim



---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


RE: [PATCH] Re: multiple gateways possible?

Posted by Danny Angus <da...@apache.org>.
Tim,

> OK let's try that again (attached). There didn't appear to be rules about
> the file format for the attachment, I used Unix style end of lines.

The rule is in the code standards, its UNIX.

 
d.

[PATCH] Re: multiple gateways possible?

Posted by Tim Stephenson <ti...@thestephensons.me.uk>.
OK let's try that again (attached). There didn't appear to be rules about
the file format for the attachment, I used Unix style end of lines.

About the 550 check: I included this in an attempt to minimise the change in
behaviour. If it is not there any failure that is not an IOException is
deemed to apply to all servers in the gateway list so they are not tried.
Since the exact reason for the failure appear not to be well understood (at
least by me) or are just broken as in your Notes example. I would prefer to
try all servers in the list in all failure cases, what do you think?
Obviously this incurs a performance penalty in cases when the failure _is_
for a more generalised reason, which is presumably why the code is as it is.

Tim
----- Original Message -----
From: "Noel J. Bergman" <no...@devtech.com>
To: "James Developers List" <ja...@jakarta.apache.org>
Sent: Saturday, May 24, 2003 5:21 PM
Subject: RE: [PATCH] Re: multiple gateways possible?


> Tim,
>
> Please see http://james.apache.org/contribute.html for the proper way to
> submit a patch.  This one was not run with -u, and was embedded in a
> message, thus corrupting its contents.  Please resubmit.  Thanks.  :-)
>
> By the way, I'm not sure where your 550 check will fit, but I did notice
the
> comment about relaying.  You might care to know that Lotus Domino
improperly
> uses 554 for relay denied, and you might get a 551 (often incorrectly
used,
> but sometimes correctly used) as well.
>
> --- Noel
>
> -----Original Message-----
> From: Tim Stephenson [mailto:tim@thestephensons.me.uk]
> Sent: Saturday, May 24, 2003 11:49
> To: James-Dev Mailing List
> Subject: [PATCH] Re: multiple gateways possible?
>
>
> Here is the patch to allow multiple gateway tags we have been discussing.
I
> have assumed that the gatewayPort tag will be deprecated and said so in a
> comment in the code. However if
>     a) the port is specified and
>     b) there is exactly one gateway specified
> then the port is concatenated to the URLName used to connect like this
>         smtp://<gateway string>:<gateway port string>
> which seems both logical and works for explicitly naming port 25 (I have
not
> tested with non-standard ports).
>
> I did not modify the code to use one of the alternative constructors for
> URLName since this way would allow the gatewy tag to be (ab)used to
specify
> such things as username and password if so desired.
>
> Tim
>
> RCS file:
>
/home/cvspublic/jakarta-james/src/java/org/apache/james/transport/mailets/Re
> moteDelivery.java,v
> retrieving revision 1.48
> diff -w -b -r1.48 RemoteDelivery.java
> 73a74
> > import java.util.StringTokenizer;
> 132c133
> <     private String gatewayPort = null;  //the port of the gateway server
> to send all email to
> ---
> >     private String gatewayPort = null;  //the port of the gateway server
> to send all email to, deprecated, include port in gateway as <host>:<port>
> 259c260,273
> <                 targetServers.add(gatewayServer);
> ---
> >                 StringTokenizer st = new StringTokenizer(gatewayServer,
> ",") ;
> >                 while (st.hasMoreTokens()) {
> >                     String server = st.nextToken().trim() ;
> >
> >                     // For backwards compatibility, if have just one
> gateway AND a gateway port
> >                     // then concatenate the port to this host -
otherwise
> ignore
> >                     if (gatewayPort != null && !st.hasMoreTokens()) {
> >                         server += ":";
> >                         server += gatewayPort;
> >                     }
> >
> >                     if (isDebug) log("Adding SMTP gateway: " + server) ;
> >                     targetServers.add(server);
> >                 }
> 299c313
> <                             // Any error on connect should cause the
> mailet to attempt
> ---
> >                             // Any error on connect (or send) should
cause
> the mailet to attempt
> 339a354,362
> >                     } else if (me.getNextException() != null &&
> >                             me.getNextException().getMessage() != null
&&
> >
> me.getNextException().getMessage().indexOf("550") > -1) {
> >                         // When using multiple gateways on different
> networks,
> >                         // this is the exception that occurs trying to
> relay on a
> >                         // gateway you are not currently entitled to, as
> such we should
> >                         // continue with other servers in the list
> >                         lastError = me;
> >                         continue;
> 713,717d735
> <         }
> <
> <         //If there's a gateway port, we can just set it here
> <         if (gatewayPort != null) {
> <             props.put("mail.smtp.port", gatewayPort);
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
>

RE: [PATCH] Re: multiple gateways possible?

Posted by "Noel J. Bergman" <no...@devtech.com>.
Tim,

Please see http://james.apache.org/contribute.html for the proper way to
submit a patch.  This one was not run with -u, and was embedded in a
message, thus corrupting its contents.  Please resubmit.  Thanks.  :-)

By the way, I'm not sure where your 550 check will fit, but I did notice the
comment about relaying.  You might care to know that Lotus Domino improperly
uses 554 for relay denied, and you might get a 551 (often incorrectly used,
but sometimes correctly used) as well.

	--- Noel

-----Original Message-----
From: Tim Stephenson [mailto:tim@thestephensons.me.uk]
Sent: Saturday, May 24, 2003 11:49
To: James-Dev Mailing List
Subject: [PATCH] Re: multiple gateways possible?


Here is the patch to allow multiple gateway tags we have been discussing. I
have assumed that the gatewayPort tag will be deprecated and said so in a
comment in the code. However if
    a) the port is specified and
    b) there is exactly one gateway specified
then the port is concatenated to the URLName used to connect like this
        smtp://<gateway string>:<gateway port string>
which seems both logical and works for explicitly naming port 25 (I have not
tested with non-standard ports).

I did not modify the code to use one of the alternative constructors for
URLName since this way would allow the gatewy tag to be (ab)used to specify
such things as username and password if so desired.

Tim

RCS file:
/home/cvspublic/jakarta-james/src/java/org/apache/james/transport/mailets/Re
moteDelivery.java,v
retrieving revision 1.48
diff -w -b -r1.48 RemoteDelivery.java
73a74
> import java.util.StringTokenizer;
132c133
<     private String gatewayPort = null;  //the port of the gateway server
to send all email to
---
>     private String gatewayPort = null;  //the port of the gateway server
to send all email to, deprecated, include port in gateway as <host>:<port>
259c260,273
<                 targetServers.add(gatewayServer);
---
>                 StringTokenizer st = new StringTokenizer(gatewayServer,
",") ;
>                 while (st.hasMoreTokens()) {
>                     String server = st.nextToken().trim() ;
>
>                     // For backwards compatibility, if have just one
gateway AND a gateway port
>                     // then concatenate the port to this host - otherwise
ignore
>                     if (gatewayPort != null && !st.hasMoreTokens()) {
>                         server += ":";
>                         server += gatewayPort;
>                     }
>
>                     if (isDebug) log("Adding SMTP gateway: " + server) ;
>                     targetServers.add(server);
>                 }
299c313
<                             // Any error on connect should cause the
mailet to attempt
---
>                             // Any error on connect (or send) should cause
the mailet to attempt
339a354,362
>                     } else if (me.getNextException() != null &&
>                             me.getNextException().getMessage() != null &&
>
me.getNextException().getMessage().indexOf("550") > -1) {
>                         // When using multiple gateways on different
networks,
>                         // this is the exception that occurs trying to
relay on a
>                         // gateway you are not currently entitled to, as
such we should
>                         // continue with other servers in the list
>                         lastError = me;
>                         continue;
713,717d735
<         }
<
<         //If there's a gateway port, we can just set it here
<         if (gatewayPort != null) {
<             props.put("mail.smtp.port", gatewayPort);



---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org