Re: James 3 b4 HELO Override Not Working?

2014-10-27 Thread Robert Munn
Your rDNS: mail.jwmhosting.com looks correct to me.

I just did a telnet check of your smtp server:

$ telnet
telnet  open mail.jwmhosting.com 25
telnet  helo foo.com

reply shows:
250 jwmhosting.com Hello foo.com [xx.xx.xx.xx]) - my ip address


What is important here is the helo name : jwmhosting.com. It should say 
mail.jwmhosting.com. This is a spammer flag and can get your mail rejected 
depending on the host. That is what the mail-tester service is complaining 
about.

You set this in smptserver.xml (smtpserver.conf in beta4?)

Look for the block below, change it :

helloName autodetect=“false”mail.jwmhosting.com/helloName


   !-- This is the name used by the server to identify itself in the SMTP --
!-- protocol.  If autodetect is TRUE, the server will discover its --
!-- own host name and use that in the protocol.  If discovery fails, 
--
!-- the value of 'localhost' is used.  If autodetect is FALSE, James 
--
!-- will use the specified value. --
!--
helloName autodetect=truemyMailServer/helloName
 --

FYI, beta4 has a deadlocking problem, you might want to upgrade to beta 5. I 
have instructions on how to build it from source on YouTube:

https://www.youtube.com/channel/UChNyi0dlyanLLhp7cA9q5dA

or if you prefer a text tutorial, on my blog:

http://blog.bonnydoonmedia.com/post.cfm/building-apache-james-from-source



On Oct 26, 2014, at 10:44 PM, Jerry Malcolm techst...@malcolms.com wrote:

 I have been running James 3 b4 for several months.  I was having some 
 outbound mail rejected by gmail and started doing some research.  I did an 
 email test using mail-tester.com and got the error message that my HELO did 
 not match the rDNS.  It reports:
 
 IP: 64.34.163.186
 HELO: p2825577
 rDNS: mail.jwmhosting.com
 
 The p2825577 number is my Windows Server 2008 machine name.  I don't want to 
 use that.
 
 In the RemoteDelivery mailet config, I have the following:
 
 mail.smtp.localhostmail.jwmhosting.com/mail.smtp.localhost
 
 If I'm reading the instructions correctly, this should cause the specified 
 value (mail.jwmhosting.com) to be sent on the HELO instead of the p282... 
 number, correct?  But it isn't.
 
 What am I doing wrong?
 
 BTW...  I tried changing my rDNS to the p282... number.  rDNS's have to be a 
 fully qualified domain name.  So it won't take it.  Fine... I then tried 
 changing my Win Server 08 machine name to be mail.jwmhosting.com.  No go on 
 that either.  Can't have periods in Win machines names So I'm stuck.  
 Please advise
 
 This is kinda urgent since I now realize that there's a distinct possibility 
 that some of my clients' emails are not getting through due to this.  So 
 thanks in advance for a quick reply to this.
 
 Jerry
 
 
 -
 To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
 For additional commands, e-mail: server-user-h...@james.apache.org
 



Re: James 3 b4 HELO Override Not Working?

2014-10-27 Thread Jerry Malcolm

Robert,

Thank you so much for the quick reply.  I will probably start the 
process of moving up to the latest beta soon.  But i know it's not a 
trivial process, and I don't want to risk destabilizing the environment 
at this point.  Just need to get this HELO thing fixed quickly and keep 
the clients happy at least for another day


I see where I left of 'mail.' in the helloName in the smtpserver.xml.  
But that appears to only be used for inbound SMTP.   In the 
mailetcontainer template file, as part of the remoteDelivery mailet, 
there is this:


  !-- Set the HELO/EHLO name to use when connectiong to remote 
SMTP-Server --

  !--
mail.smtp.localhostmyMailServer/mail.smtp.localhost
--
   /mailet

Why are there two different places to specify the HELO name?  If the 
smtpserver.xml one is supposed to be used for inbound and outbound, this 
is redundant.  I know smtpserver.xml hello is used for inbound smtp. 
That is working. But it appears that James isn't using either one of 
these (the smtpserver hello def or the RemoteDelivery HELO def) for 
OUTBOUND smtp (which is the one I care about).  After changing the 
smtpserver.xml to mail.jwmhosting.com and verifying the remoteDelivery 
mailet HELO def is also mail.jwmhosting.com, mail-tester reports that 
it's still getting the Win Server machine name


At this point, I'm willing to hardcode the HELO in the java file and 
rebuild the jar.  But I'm not that familiar with the James source. By 
chance could you point me to a particular class or package inside James 
where the HELO command is sent on outbound?


Thanks again.

Jerry


On 10/27/2014 3:51 AM, Robert Munn wrote:

Your rDNS: mail.jwmhosting.com looks correct to me.

I just did a telnet check of your smtp server:

$ telnet
telnet  open mail.jwmhosting.com 25
telnet  helo foo.com

reply shows:
250 jwmhosting.com Hello foo.com [xx.xx.xx.xx]) - my ip address


What is important here is the helo name : jwmhosting.com. It should say 
mail.jwmhosting.com. This is a spammer flag and can get your mail rejected 
depending on the host. That is what the mail-tester service is complaining 
about.

You set this in smptserver.xml (smtpserver.conf in beta4?)

Look for the block below, change it :

helloName autodetect=“false”mail.jwmhosting.com/helloName


!-- This is the name used by the server to identify itself in the SMTP --
 !-- protocol.  If autodetect is TRUE, the server will discover its --
 !-- own host name and use that in the protocol.  If discovery fails, 
--
 !-- the value of 'localhost' is used.  If autodetect is FALSE, James 
--
 !-- will use the specified value. --
 !--
 helloName autodetect=truemyMailServer/helloName
  --

FYI, beta4 has a deadlocking problem, you might want to upgrade to beta 5. I 
have instructions on how to build it from source on YouTube:

https://www.youtube.com/channel/UChNyi0dlyanLLhp7cA9q5dA

or if you prefer a text tutorial, on my blog:

http://blog.bonnydoonmedia.com/post.cfm/building-apache-james-from-source



On Oct 26, 2014, at 10:44 PM, Jerry Malcolm techst...@malcolms.com wrote:


I have been running James 3 b4 for several months.  I was having some outbound 
mail rejected by gmail and started doing some research.  I did an email test 
using mail-tester.com and got the error message that my HELO did not match the 
rDNS.  It reports:

IP: 64.34.163.186
HELO: p2825577
rDNS: mail.jwmhosting.com

The p2825577 number is my Windows Server 2008 machine name.  I don't want to 
use that.

In the RemoteDelivery mailet config, I have the following:

mail.smtp.localhostmail.jwmhosting.com/mail.smtp.localhost

If I'm reading the instructions correctly, this should cause the specified 
value (mail.jwmhosting.com) to be sent on the HELO instead of the p282... 
number, correct?  But it isn't.

What am I doing wrong?

BTW...  I tried changing my rDNS to the p282... number.  rDNS's have to be a 
fully qualified domain name.  So it won't take it.  Fine... I then tried 
changing my Win Server 08 machine name to be mail.jwmhosting.com.  No go on 
that either.  Can't have periods in Win machines names So I'm stuck.  
Please advise

This is kinda urgent since I now realize that there's a distinct possibility 
that some of my clients' emails are not getting through due to this.  So thanks 
in advance for a quick reply to this.

Jerry


-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org





-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5315 / Virus Database: 4189/8459 - Release Date: 10/26/14




-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org



Re: James 3 b4 HELO Override Not Working?

2014-10-27 Thread Jerry Malcolm
More progress... But now I'm really stumped.  I dug into the 
remoteDelivery mailet source.  I did confirm that James is NOT using the 
smtpserver.xml 'hello' value at all for outbound HELO.  It is definitely 
using the config parms for the remoteDelivery mailet.


In the mailet, the outbound HELO value is set by javax.mail.Transport 
based on the 'mail.smtp.localhost' property passed in via the Properties 
object.  According to the Transport javadoc, it says it'll use the 
property value for HELO if it's set, and if it's not set, it'll use 
InetAddress.getLocalHost().getHostName().  Fine.  So I cloned the mailet 
so I could add log statements and do some debug.   I add two log 
statements right above the 'transport.sendMessage()' call in the 
RemoteDelivery mailet:


 log( JWMRemoteDelivery.deliver() mail.smtp.localhost -  + 
props.getProperty( mail.smtp.localhost ));


 log( JWMRemoteDelivery.deliver() 
InetAddress.getLocalHost().getHostName() -  + 
InetAddress.getLocalHost().getHostName() );


  transport.sendMessage(message, addr);

In the log, I get

INFO  09:52:19,480 | james.mailetcontext | JWMRemoteDelivery.deliver() 
mail.smtp.localhost - mail.jwmhosting.com


INFO  09:52:19,480 | james.mailetcontext | JWMRemoteDelivery.deliver() 
InetAddress.getLocalHost().getHostName() - p2825577


This is precisely what I expected to get.  BUT when the mail is 
sent, the p282 is sent in the HELO.


It appears that javax.mail.Transport is ignoring the property (or not 
recognizing that it is set).  But I'm pretty certain that a bug that is 
that blatant would not be hanging around unreported in a base java class 
like Transport.  But, then again, that's what I appear to be seeing.


Where am I going wrong?

Secondarily, anybody know how I can change what java reports back on the 
InetAddress call other than changing the machine name?  Is there a JVM 
parameter I can pass in?  If I can force that, problem solved for me 
(although it's still not working correctly).


Thanks again.

Jerry



-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org



Re: James 3 b4 HELO Override Not Working?

2014-10-27 Thread Robert Munn
Here is the answer, in RemoteDelivery.java, line 136:

 * libheloName/b (optional) - a String containing the name used in the 
SMTP HELO and EHLO commands. Default is the default domain,
 * which is typically codelocalhost/code./li


so in mailetcontainer.xml, this line:

!-- Set the HELO/EHLO name to use when connectiong to remote SMTP-Server --
mail.smtp.localhostmail.jwmhosting.com/mail.smtp.localhost

should be this:

heloNamemail.jwmhosting.com/heloName


change, restart, and retry, you should be good to go.
   
On Oct 27, 2014, at 1:51 AM, Robert Munn robert.d.m...@gmail.com wrote:

 Your rDNS: mail.jwmhosting.com looks correct to me.
 
 I just did a telnet check of your smtp server:
 
 $ telnet
 telnet  open mail.jwmhosting.com 25
 telnet  helo foo.com
 
 reply shows:
 250 jwmhosting.com Hello foo.com [xx.xx.xx.xx]) - my ip address
 
 
 What is important here is the helo name : jwmhosting.com. It should say 
 mail.jwmhosting.com. This is a spammer flag and can get your mail rejected 
 depending on the host. That is what the mail-tester service is complaining 
 about.
 
 You set this in smptserver.xml (smtpserver.conf in beta4?)
 
 Look for the block below, change it :
 
 helloName autodetect=“false”mail.jwmhosting.com/helloName
 
 
!-- This is the name used by the server to identify itself in the SMTP --
 !-- protocol.  If autodetect is TRUE, the server will discover its 
 --
 !-- own host name and use that in the protocol.  If discovery fails, 
 --
 !-- the value of 'localhost' is used.  If autodetect is FALSE, James 
 --
 !-- will use the specified value. --
 !--
 helloName autodetect=truemyMailServer/helloName
  --
 
 FYI, beta4 has a deadlocking problem, you might want to upgrade to beta 5. I 
 have instructions on how to build it from source on YouTube:
 
 https://www.youtube.com/channel/UChNyi0dlyanLLhp7cA9q5dA
 
 or if you prefer a text tutorial, on my blog:
 
 http://blog.bonnydoonmedia.com/post.cfm/building-apache-james-from-source
 
 
 
 On Oct 26, 2014, at 10:44 PM, Jerry Malcolm techst...@malcolms.com wrote:
 
 I have been running James 3 b4 for several months.  I was having some 
 outbound mail rejected by gmail and started doing some research.  I did an 
 email test using mail-tester.com and got the error message that my HELO did 
 not match the rDNS.  It reports:
 
 IP: 64.34.163.186
 HELO: p2825577
 rDNS: mail.jwmhosting.com
 
 The p2825577 number is my Windows Server 2008 machine name.  I don't want to 
 use that.
 
 In the RemoteDelivery mailet config, I have the following:
 
 mail.smtp.localhostmail.jwmhosting.com/mail.smtp.localhost
 
 If I'm reading the instructions correctly, this should cause the specified 
 value (mail.jwmhosting.com) to be sent on the HELO instead of the p282... 
 number, correct?  But it isn't.
 
 What am I doing wrong?
 
 BTW...  I tried changing my rDNS to the p282... number.  rDNS's have to be a 
 fully qualified domain name.  So it won't take it.  Fine... I then tried 
 changing my Win Server 08 machine name to be mail.jwmhosting.com.  No go on 
 that either.  Can't have periods in Win machines names So I'm stuck.  
 Please advise
 
 This is kinda urgent since I now realize that there's a distinct possibility 
 that some of my clients' emails are not getting through due to this.  So 
 thanks in advance for a quick reply to this.
 
 Jerry
 
 
 -
 To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
 For additional commands, e-mail: server-user-h...@james.apache.org
 
 



Re: James 3 b4 HELO Override Not Working?

2014-10-27 Thread Robert Munn
hmm, wait, that isn’t working . another check ...

On Oct 27, 2014, at 1:51 AM, Robert Munn robert.d.m...@gmail.com wrote:

 Your rDNS: mail.jwmhosting.com looks correct to me.
 
 I just did a telnet check of your smtp server:
 
 $ telnet
 telnet  open mail.jwmhosting.com 25
 telnet  helo foo.com
 
 reply shows:
 250 jwmhosting.com Hello foo.com [xx.xx.xx.xx]) - my ip address
 
 
 What is important here is the helo name : jwmhosting.com. It should say 
 mail.jwmhosting.com. This is a spammer flag and can get your mail rejected 
 depending on the host. That is what the mail-tester service is complaining 
 about.
 
 You set this in smptserver.xml (smtpserver.conf in beta4?)
 
 Look for the block below, change it :
 
 helloName autodetect=“false”mail.jwmhosting.com/helloName
 
 
!-- This is the name used by the server to identify itself in the SMTP --
 !-- protocol.  If autodetect is TRUE, the server will discover its 
 --
 !-- own host name and use that in the protocol.  If discovery fails, 
 --
 !-- the value of 'localhost' is used.  If autodetect is FALSE, James 
 --
 !-- will use the specified value. --
 !--
 helloName autodetect=truemyMailServer/helloName
  --
 
 FYI, beta4 has a deadlocking problem, you might want to upgrade to beta 5. I 
 have instructions on how to build it from source on YouTube:
 
 https://www.youtube.com/channel/UChNyi0dlyanLLhp7cA9q5dA
 
 or if you prefer a text tutorial, on my blog:
 
 http://blog.bonnydoonmedia.com/post.cfm/building-apache-james-from-source
 
 
 
 On Oct 26, 2014, at 10:44 PM, Jerry Malcolm techst...@malcolms.com wrote:
 
 I have been running James 3 b4 for several months.  I was having some 
 outbound mail rejected by gmail and started doing some research.  I did an 
 email test using mail-tester.com and got the error message that my HELO did 
 not match the rDNS.  It reports:
 
 IP: 64.34.163.186
 HELO: p2825577
 rDNS: mail.jwmhosting.com
 
 The p2825577 number is my Windows Server 2008 machine name.  I don't want to 
 use that.
 
 In the RemoteDelivery mailet config, I have the following:
 
 mail.smtp.localhostmail.jwmhosting.com/mail.smtp.localhost
 
 If I'm reading the instructions correctly, this should cause the specified 
 value (mail.jwmhosting.com) to be sent on the HELO instead of the p282... 
 number, correct?  But it isn't.
 
 What am I doing wrong?
 
 BTW...  I tried changing my rDNS to the p282... number.  rDNS's have to be a 
 fully qualified domain name.  So it won't take it.  Fine... I then tried 
 changing my Win Server 08 machine name to be mail.jwmhosting.com.  No go on 
 that either.  Can't have periods in Win machines names So I'm stuck.  
 Please advise
 
 This is kinda urgent since I now realize that there's a distinct possibility 
 that some of my clients' emails are not getting through due to this.  So 
 thanks in advance for a quick reply to this.
 
 Jerry
 
 
 -
 To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
 For additional commands, e-mail: server-user-h...@james.apache.org
 
 



AW: Re: James 3 b4 HELO Override Not Working? [unsigned]

2014-10-27 Thread Bernd Waibel
Hi Jerry

I am not using v3 but:

Could you try setting the parameter -Djava.mail.localhost=mail.jwmhosting.com 
in the java startup command line?

Most java.mail parameters are only parsed on startup by the vm.


Ciao.
Bernd



 Ursprüngliche Nachricht 
Von: Jerry Malcolm techst...@malcolms.com
Datum:
An: James Users List server-user@james.apache.org
Betreff: Re: James 3 b4 HELO Override Not Working?


More progress... But now I'm really stumped.  I dug into the
remoteDelivery mailet source.  I did confirm that James is NOT using the
smtpserver.xml 'hello' value at all for outbound HELO.  It is definitely
using the config parms for the remoteDelivery mailet.

In the mailet, the outbound HELO value is set by javax.mail.Transport
based on the 'mail.smtp.localhost' property passed in via the Properties
object.  According to the Transport javadoc, it says it'll use the
property value for HELO if it's set, and if it's not set, it'll use
InetAddress.getLocalHost().getHostName().  Fine.  So I cloned the mailet
so I could add log statements and do some debug.   I add two log
statements right above the 'transport.sendMessage()' call in the
RemoteDelivery mailet:

  log( JWMRemoteDelivery.deliver() mail.smtp.localhost -  +
props.getProperty( mail.smtp.localhost ));

  log( JWMRemoteDelivery.deliver()
InetAddress.getLocalHost().getHostName() -  +
InetAddress.getLocalHost().getHostName() );

   transport.sendMessage(message, addr);

In the log, I get

INFO  09:52:19,480 | james.mailetcontext | JWMRemoteDelivery.deliver()
mail.smtp.localhost - mail.jwmhosting.com

INFO  09:52:19,480 | james.mailetcontext | JWMRemoteDelivery.deliver()
InetAddress.getLocalHost().getHostName() - p2825577

This is precisely what I expected to get.  BUT when the mail is
sent, the p282 is sent in the HELO.

It appears that javax.mail.Transport is ignoring the property (or not
recognizing that it is set).  But I'm pretty certain that a bug that is
that blatant would not be hanging around unreported in a base java class
like Transport.  But, then again, that's what I appear to be seeing.

Where am I going wrong?

Secondarily, anybody know how I can change what java reports back on the
InetAddress call other than changing the machine name?  Is there a JVM
parameter I can pass in?  If I can force that, problem solved for me
(although it's still not working correctly).

Thanks again.

Jerry



-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org



Re: James 3 b4 HELO Override Not Working?

2014-10-27 Thread Robert Munn
well, this looks like it is hard-coded in AbstractConfigurableAsyncServer.java 
in the trunk code,

/**
 * Configure the helloName for the given Configuration
 * 
 * @param handlerConfiguration
 * @throws ConfigurationException
 */
protected void configureHelloName(Configuration handlerConfiguration) 
throws ConfigurationException {
StringBuilder infoBuffer;
String hostName;
try {
hostName = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException ue) {
hostName = localhost;
}

infoBuffer = new StringBuilder(64).append(getServiceType()).append( is 
running on: ).append(hostName);
getLogger().info(infoBuffer.toString());

boolean autodetect = handlerConfiguration.getBoolean(HELLO_NAME + 
.[@autodetect], true);
if (autodetect) {
helloName = hostName;
} else {
helloName = handlerConfiguration.getString(HELLO_NAME);
if (helloName == null || helloName.trim().length()  1) {
throw new ConfigurationException(Please configure the 
helloName or use autodetect);
}
}

infoBuffer = new StringBuilder(64).append(getServiceType()).append( 
handler hello name is: ).append(helloName);
getLogger().info(infoBuffer.toString());
}

I am looking at a fix for this, but I am not an expert in this codebase either. 




On Oct 27, 2014, at 9:07 AM, Robert Munn robert.d.m...@gmail.com wrote:

 hmm, wait, that isn’t working . another check ...
 
 On Oct 27, 2014, at 1:51 AM, Robert Munn robert.d.m...@gmail.com wrote:
 
 Your rDNS: mail.jwmhosting.com looks correct to me.
 
 I just did a telnet check of your smtp server:
 
 $ telnet
 telnet  open mail.jwmhosting.com 25
 telnet  helo foo.com
 
 reply shows:
 250 jwmhosting.com Hello foo.com [xx.xx.xx.xx]) - my ip address
 
 
 What is important here is the helo name : jwmhosting.com. It should say 
 mail.jwmhosting.com. This is a spammer flag and can get your mail rejected 
 depending on the host. That is what the mail-tester service is complaining 
 about.
 
 You set this in smptserver.xml (smtpserver.conf in beta4?)
 
 Look for the block below, change it :
 
 helloName autodetect=“false”mail.jwmhosting.com/helloName
 
 
!-- This is the name used by the server to identify itself in the SMTP 
 --
 !-- protocol.  If autodetect is TRUE, the server will discover its 
 --
 !-- own host name and use that in the protocol.  If discovery 
 fails, --
 !-- the value of 'localhost' is used.  If autodetect is FALSE, 
 James --
 !-- will use the specified value. --
 !--
 helloName autodetect=truemyMailServer/helloName
  --
 
 FYI, beta4 has a deadlocking problem, you might want to upgrade to beta 5. I 
 have instructions on how to build it from source on YouTube:
 
 https://www.youtube.com/channel/UChNyi0dlyanLLhp7cA9q5dA
 
 or if you prefer a text tutorial, on my blog:
 
 http://blog.bonnydoonmedia.com/post.cfm/building-apache-james-from-source
 
 
 
 On Oct 26, 2014, at 10:44 PM, Jerry Malcolm techst...@malcolms.com wrote:
 
 I have been running James 3 b4 for several months.  I was having some 
 outbound mail rejected by gmail and started doing some research.  I did an 
 email test using mail-tester.com and got the error message that my HELO did 
 not match the rDNS.  It reports:
 
 IP: 64.34.163.186
 HELO: p2825577
 rDNS: mail.jwmhosting.com
 
 The p2825577 number is my Windows Server 2008 machine name.  I don't want 
 to use that.
 
 In the RemoteDelivery mailet config, I have the following:
 
 mail.smtp.localhostmail.jwmhosting.com/mail.smtp.localhost
 
 If I'm reading the instructions correctly, this should cause the specified 
 value (mail.jwmhosting.com) to be sent on the HELO instead of the p282... 
 number, correct?  But it isn't.
 
 What am I doing wrong?
 
 BTW...  I tried changing my rDNS to the p282... number.  rDNS's have to be 
 a fully qualified domain name.  So it won't take it.  Fine... I then tried 
 changing my Win Server 08 machine name to be mail.jwmhosting.com.  No go on 
 that either.  Can't have periods in Win machines names So I'm stuck.  
 Please advise
 
 This is kinda urgent since I now realize that there's a distinct 
 possibility that some of my clients' emails are not getting through due to 
 this.  So thanks in advance for a quick reply to this.
 
 Jerry
 
 
 -
 To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
 For additional commands, e-mail: server-user-h...@james.apache.org
 
 
 



Re: James 3 b4 HELO Override Not Working? [unsigned]

2014-10-27 Thread Robert Munn
Bernd,

See my previous note, I think the java.mail.localhost parameter is being 
ignored in the source code. I tried your suggestion and it did not seem to make 
a difference. I added the parameter as an argument in wrapper.conf as:

wrapper.java.additional.15=-Dhostname

But that change was not picked up.

I am testing a temporary patch of AbstractConfigurableAsyncServer.java, trying 
to do a build, but repository.apache.org is throwing a 503 error Service 
Temporarily Unavailable. It took 14 minutes to do a build, and I’m not sure the 
build is good, although it reported success. I am going to test my patch and 
report back.

Robert




On Oct 27, 2014, at 9:09 AM, Bernd Waibel bwai...@intarsys.de wrote:

 Hi Jerry
 
 I am not using v3 but:
 
 Could you try setting the parameter 
 -Djava.mail.localhost=mail.jwmhosting.com in the java startup command line?
 
 Most java.mail parameters are only parsed on startup by the vm.
 
 
 Ciao.
 Bernd
 
 
 
  Ursprüngliche Nachricht 
 Von: Jerry Malcolm techst...@malcolms.com
 Datum:
 An: James Users List server-user@james.apache.org
 Betreff: Re: James 3 b4 HELO Override Not Working?
 
 
 More progress... But now I'm really stumped.  I dug into the
 remoteDelivery mailet source.  I did confirm that James is NOT using the
 smtpserver.xml 'hello' value at all for outbound HELO.  It is definitely
 using the config parms for the remoteDelivery mailet.
 
 In the mailet, the outbound HELO value is set by javax.mail.Transport
 based on the 'mail.smtp.localhost' property passed in via the Properties
 object.  According to the Transport javadoc, it says it'll use the
 property value for HELO if it's set, and if it's not set, it'll use
 InetAddress.getLocalHost().getHostName().  Fine.  So I cloned the mailet
 so I could add log statements and do some debug.   I add two log
 statements right above the 'transport.sendMessage()' call in the
 RemoteDelivery mailet:
 
  log( JWMRemoteDelivery.deliver() mail.smtp.localhost -  +
 props.getProperty( mail.smtp.localhost ));
 
  log( JWMRemoteDelivery.deliver()
 InetAddress.getLocalHost().getHostName() -  +
 InetAddress.getLocalHost().getHostName() );
 
   transport.sendMessage(message, addr);
 
 In the log, I get
 
 INFO  09:52:19,480 | james.mailetcontext | JWMRemoteDelivery.deliver()
 mail.smtp.localhost - mail.jwmhosting.com
 
 INFO  09:52:19,480 | james.mailetcontext | JWMRemoteDelivery.deliver()
 InetAddress.getLocalHost().getHostName() - p2825577
 
 This is precisely what I expected to get.  BUT when the mail is
 sent, the p282 is sent in the HELO.
 
 It appears that javax.mail.Transport is ignoring the property (or not
 recognizing that it is set).  But I'm pretty certain that a bug that is
 that blatant would not be hanging around unreported in a base java class
 like Transport.  But, then again, that's what I appear to be seeing.
 
 Where am I going wrong?
 
 Secondarily, anybody know how I can change what java reports back on the
 InetAddress call other than changing the machine name?  Is there a JVM
 parameter I can pass in?  If I can force that, problem solved for me
 (although it's still not working correctly).
 
 Thanks again.
 
 Jerry
 
 
 
 -
 To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
 For additional commands, e-mail: server-user-h...@james.apache.org
 



Re: James 3 b4 HELO Override Not Working? [unsigned]

2014-10-27 Thread Robert Munn
looking for the proper geronimo sources right now …

On Oct 27, 2014, at 10:31 AM, Jerry Malcolm techst...@malcolms.com wrote:

 Robert,
 
 Where does the abstract configurator enter the flow?  Unless it overrides the 
 InetAddress.getLocalHost().getHostname() call, I don't think it will help 
 since that is the ONLY thing the transport is looking at for HELO.  Details 
 in my previous post. I believe the actual error is in:
 
 org.apache.geronimo.javamail.transport.smtp.SMTPConnection.java
 
 I can make the fix to that class if you have the ability to rebuild the 
 geronimo.javamail.jar file.
 
 Thanks.
 
 Jerry
 
 
 
 
 On 10/27/2014 12:16 PM, Robert Munn wrote:
 Bernd,
 
 See my previous note, I think the java.mail.localhost parameter is being 
 ignored in the source code. I tried your suggestion and it did not seem to 
 make a difference. I added the parameter as an argument in wrapper.conf as:
 
 wrapper.java.additional.15=-Dhostname
 
 But that change was not picked up.
 
 I am testing a temporary patch of AbstractConfigurableAsyncServer.java, 
 trying to do a build, but repository.apache.org is throwing a 503 error 
 Service Temporarily Unavailable. It took 14 minutes to do a build, and I’m 
 not sure the build is good, although it reported success. I am going to test 
 my patch and report back.
 
 Robert
 
 
 
 
 On Oct 27, 2014, at 9:09 AM, Bernd Waibel bwai...@intarsys.de wrote:
 
 Hi Jerry
 
 I am not using v3 but:
 
 Could you try setting the parameter 
 -Djava.mail.localhost=mail.jwmhosting.com in the java startup command 
 line?
 
 Most java.mail parameters are only parsed on startup by the vm.
 
 
 Ciao.
 Bernd
 
 
 
  Ursprüngliche Nachricht 
 Von: Jerry Malcolm techst...@malcolms.com
 Datum:
 An: James Users List server-user@james.apache.org
 Betreff: Re: James 3 b4 HELO Override Not Working?
 
 
 More progress... But now I'm really stumped.  I dug into the
 remoteDelivery mailet source.  I did confirm that James is NOT using the
 smtpserver.xml 'hello' value at all for outbound HELO.  It is definitely
 using the config parms for the remoteDelivery mailet.
 
 In the mailet, the outbound HELO value is set by javax.mail.Transport
 based on the 'mail.smtp.localhost' property passed in via the Properties
 object.  According to the Transport javadoc, it says it'll use the
 property value for HELO if it's set, and if it's not set, it'll use
 InetAddress.getLocalHost().getHostName().  Fine.  So I cloned the mailet
 so I could add log statements and do some debug.   I add two log
 statements right above the 'transport.sendMessage()' call in the
 RemoteDelivery mailet:
 
  log( JWMRemoteDelivery.deliver() mail.smtp.localhost -  +
 props.getProperty( mail.smtp.localhost ));
 
  log( JWMRemoteDelivery.deliver()
 InetAddress.getLocalHost().getHostName() -  +
 InetAddress.getLocalHost().getHostName() );
 
   transport.sendMessage(message, addr);
 
 In the log, I get
 
 INFO  09:52:19,480 | james.mailetcontext | JWMRemoteDelivery.deliver()
 mail.smtp.localhost - mail.jwmhosting.com
 
 INFO  09:52:19,480 | james.mailetcontext | JWMRemoteDelivery.deliver()
 InetAddress.getLocalHost().getHostName() - p2825577
 
 This is precisely what I expected to get.  BUT when the mail is
 sent, the p282 is sent in the HELO.
 
 It appears that javax.mail.Transport is ignoring the property (or not
 recognizing that it is set).  But I'm pretty certain that a bug that is
 that blatant would not be hanging around unreported in a base java class
 like Transport.  But, then again, that's what I appear to be seeing.
 
 Where am I going wrong?
 
 Secondarily, anybody know how I can change what java reports back on the
 InetAddress call other than changing the machine name?  Is there a JVM
 parameter I can pass in?  If I can force that, problem solved for me
 (although it's still not working correctly).
 
 Thanks again.
 
 Jerry
 
 
 
 -
 To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
 For additional commands, e-mail: server-user-h...@james.apache.org
 
 
 
 
 -
 No virus found in this message.
 Checked by AVG - www.avg.com
 Version: 2015.0.5315 / Virus Database: 4189/8462 - Release Date: 10/27/14
 
 
 
 -
 To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
 For additional commands, e-mail: server-user-h...@james.apache.org
 


-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org



Re: James 3 b4 HELO Override Not Working? [unsigned]

2014-10-27 Thread Robert Munn
ok, found the source, running a test build now. 

Here is the source repo for the version we need: 

http://svn.apache.org/repos/asf/geronimo/javamail/tags/geronimo-javamail_1.4-1.8.3/



On Oct 27, 2014, at 9:09 AM, Bernd Waibel bwai...@intarsys.de wrote:

 Hi Jerry
 
 I am not using v3 but:
 
 Could you try setting the parameter 
 -Djava.mail.localhost=mail.jwmhosting.com in the java startup command line?
 
 Most java.mail parameters are only parsed on startup by the vm.
 
 
 Ciao.
 Bernd
 
 
 
  Ursprüngliche Nachricht 
 Von: Jerry Malcolm techst...@malcolms.com
 Datum:
 An: James Users List server-user@james.apache.org
 Betreff: Re: James 3 b4 HELO Override Not Working?
 
 
 More progress... But now I'm really stumped.  I dug into the
 remoteDelivery mailet source.  I did confirm that James is NOT using the
 smtpserver.xml 'hello' value at all for outbound HELO.  It is definitely
 using the config parms for the remoteDelivery mailet.
 
 In the mailet, the outbound HELO value is set by javax.mail.Transport
 based on the 'mail.smtp.localhost' property passed in via the Properties
 object.  According to the Transport javadoc, it says it'll use the
 property value for HELO if it's set, and if it's not set, it'll use
 InetAddress.getLocalHost().getHostName().  Fine.  So I cloned the mailet
 so I could add log statements and do some debug.   I add two log
 statements right above the 'transport.sendMessage()' call in the
 RemoteDelivery mailet:
 
  log( JWMRemoteDelivery.deliver() mail.smtp.localhost -  +
 props.getProperty( mail.smtp.localhost ));
 
  log( JWMRemoteDelivery.deliver()
 InetAddress.getLocalHost().getHostName() -  +
 InetAddress.getLocalHost().getHostName() );
 
   transport.sendMessage(message, addr);
 
 In the log, I get
 
 INFO  09:52:19,480 | james.mailetcontext | JWMRemoteDelivery.deliver()
 mail.smtp.localhost - mail.jwmhosting.com
 
 INFO  09:52:19,480 | james.mailetcontext | JWMRemoteDelivery.deliver()
 InetAddress.getLocalHost().getHostName() - p2825577
 
 This is precisely what I expected to get.  BUT when the mail is
 sent, the p282 is sent in the HELO.
 
 It appears that javax.mail.Transport is ignoring the property (or not
 recognizing that it is set).  But I'm pretty certain that a bug that is
 that blatant would not be hanging around unreported in a base java class
 like Transport.  But, then again, that's what I appear to be seeing.
 
 Where am I going wrong?
 
 Secondarily, anybody know how I can change what java reports back on the
 InetAddress call other than changing the machine name?  Is there a JVM
 parameter I can pass in?  If I can force that, problem solved for me
 (although it's still not working correctly).
 
 Thanks again.
 
 Jerry
 
 
 
 -
 To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
 For additional commands, e-mail: server-user-h...@james.apache.org
 


-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org



Re: James 3 b4 HELO Override Not Working?

2014-10-27 Thread Robert Munn
More info. SMPTConnection.java extends MailConnection.java which has a method 
with this signature:

  public boolean protocolConnect(String host, int port, String username, String 
password) throws MessagingException

If you fail to pass ‘host’ as an argument to the method, the host defaults to 
‘localhost’. A patch could be made there. A better patch would be to find the 
upstream code that is calling this method and patch it to send the correct 
hostname. I am hunting for that location, please let me know if you have any 
suggestions...




On Oct 27, 2014, at 10:25 AM, Jerry Malcolm techst...@malcolms.com wrote:

 Thanks for jumping in and investigating.  This has gone from ugly to 
 horrible  I think I have found the culprit.
 
 I first had to figure out who is providing the class for SMTPTransport.  I 
 figured out that the package for SMTPTransport is: 
 org.apache.geronimo.javamail.transport.smtp.  So it is NOT a base JVM 
 implementation It's apache, and I am about to withdraw my statement that 
 'surely the transport class couldn't be ignoring a property.
 
 Geronimo's SMTPTransport.java uses a class SMTPConnection which actually 
 returns the localhost name.  And... no surprise at this point, it totally 
 ignores the mail.smtp.localhost property. The property doesn't even appear 
 anywher in the class.  First line in getLocalHost() pulls the 
 InetAddress.getLocalHost().getHostName() value.
 
 So half the problem is done... we know the culprit.  Now I guess (oh 
 joy) I get to download the whole geronimo package, set up a build 
 process, fix the code, and replace the jar on my server. (yuck).
 
 That is... unless someone already has a VERY quick way to patch and rebuild 
 geronimo.  Looking for volunteers :-)
 
 In the meantime, I will also try adding that JVM parameter to try to override 
 the Win Server machine name.
 
 Still open to other suggestions for quicker workaround.
 
 Thanks.
 
 Jerry
 
 -
 To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
 For additional commands, e-mail: server-user-h...@james.apache.org
 



Re: James 3 b4 HELO Override Not Working? [unsigned]

2014-10-27 Thread Jerry Malcolm
The remoteDelivery mailet gets a session instance, and the session 
instance returns a geronimo 'transport' instance.  Not sure how it knows 
to find the class in the geronimo package.  But I did a 
transport.getClass().getPackage() in the mailet, and it returned the 
geronimo path.  So somehow it knows that geronimo is the provider.


Please email me the jar or post it where i can get it once you get it built.

Thank you so much!

Jerry


On 10/27/2014 12:56 PM, Robert Munn wrote:

Test build looks good. I have imported the geronimo code into Eclipse for 
editing.

I don’t see directly in the code where the geronimo javamail package is being 
called, but there are references to it in the file

james-karaf-features-3.0.0-beta5-SNAPSHOT-features.xml

 feature name=james-server-mailetcontainer-api 
version=3.0.0-beta5-SNAPSHOT
 
bundlemvn:org.apache.james/james-server-mailetcontainer-api/3.0.0-beta5-SNAPSHOT/bundle
 bundlemvn:org.apache.james/apache-mailet-api/2.5.1-SNAPSHOT/bundle
 
bundlemvn:org.apache.geronimo.javamail/geronimo-javamail_1.4_mail/1.8.3/bundle
 /feature


On Oct 27, 2014, at 9:09 AM, Bernd Waibel bwai...@intarsys.de wrote:


Hi Jerry

I am not using v3 but:

Could you try setting the parameter -Djava.mail.localhost=mail.jwmhosting.com 
in the java startup command line?

Most java.mail parameters are only parsed on startup by the vm.


Ciao.
Bernd



 Ursprüngliche Nachricht 
Von: Jerry Malcolm techst...@malcolms.com
Datum:
An: James Users List server-user@james.apache.org
Betreff: Re: James 3 b4 HELO Override Not Working?


More progress... But now I'm really stumped.  I dug into the
remoteDelivery mailet source.  I did confirm that James is NOT using the
smtpserver.xml 'hello' value at all for outbound HELO.  It is definitely
using the config parms for the remoteDelivery mailet.

In the mailet, the outbound HELO value is set by javax.mail.Transport
based on the 'mail.smtp.localhost' property passed in via the Properties
object.  According to the Transport javadoc, it says it'll use the
property value for HELO if it's set, and if it's not set, it'll use
InetAddress.getLocalHost().getHostName().  Fine.  So I cloned the mailet
so I could add log statements and do some debug.   I add two log
statements right above the 'transport.sendMessage()' call in the
RemoteDelivery mailet:

  log( JWMRemoteDelivery.deliver() mail.smtp.localhost -  +
props.getProperty( mail.smtp.localhost ));

  log( JWMRemoteDelivery.deliver()
InetAddress.getLocalHost().getHostName() -  +
InetAddress.getLocalHost().getHostName() );

   transport.sendMessage(message, addr);

In the log, I get

INFO  09:52:19,480 | james.mailetcontext | JWMRemoteDelivery.deliver()
mail.smtp.localhost - mail.jwmhosting.com

INFO  09:52:19,480 | james.mailetcontext | JWMRemoteDelivery.deliver()
InetAddress.getLocalHost().getHostName() - p2825577

This is precisely what I expected to get.  BUT when the mail is
sent, the p282 is sent in the HELO.

It appears that javax.mail.Transport is ignoring the property (or not
recognizing that it is set).  But I'm pretty certain that a bug that is
that blatant would not be hanging around unreported in a base java class
like Transport.  But, then again, that's what I appear to be seeing.

Where am I going wrong?

Secondarily, anybody know how I can change what java reports back on the
InetAddress call other than changing the machine name?  Is there a JVM
parameter I can pass in?  If I can force that, problem solved for me
(although it's still not working correctly).

Thanks again.

Jerry



-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org





-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5315 / Virus Database: 4189/8462 - Release Date: 10/27/14




-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org



Re: James 3 b4 HELO Override Not Working?

2014-10-27 Thread Jerry Malcolm
mailet calls 'transport' which is an SMTPTransport instance. 
SMTPTransport calls SMTPConnection.getLocalHost() which is inherited 
from MailConnection.getLocalHost().


That method returns the InetAddress().getLocalHost().getHostName() 
first.  According to the spec, that should only occur IF the property 
mail.smtp.localhost is not set.  So i think the fix should be in that 
method.


The very first thing in the MailConnection.getLocalHost()  method should 
be something like:

---
if ( props.getProperty( mail.smtp.localhost ) != null ) return( 
props.getProperty( mail.smtp.localhost ));

---
Then let it try all of the other options if and only if this property is 
NOT set.


Jerry

On 10/27/2014 1:07 PM, Robert Munn wrote:

More info. SMPTConnection.java extends MailConnection.java which has a method 
with this signature:

   public boolean protocolConnect(String host, int port, String username, 
String password) throws MessagingException

If you fail to pass ‘host’ as an argument to the method, the host defaults to 
‘localhost’. A patch could be made there. A better patch would be to find the 
upstream code that is calling this method and patch it to send the correct 
hostname. I am hunting for that location, please let me know if you have any 
suggestions...




On Oct 27, 2014, at 10:25 AM, Jerry Malcolm techst...@malcolms.com wrote:


Thanks for jumping in and investigating.  This has gone from ugly to 
horrible  I think I have found the culprit.

I first had to figure out who is providing the class for SMTPTransport.   figured 
out that the package for SMTPTransport is: 
org.apache.geronimo.javamail.transport.smtp.  So it is NOT a base JVM 
implementation It's apache, and I am about to withdraw my statement that 'surely 
the transport class couldn't be ignoring a property.

Geronimo's SMTPTransport.java uses a class SMTPConnection which actually 
returns the localhost name.  And... no surprise at this point, it totally 
ignores the mail.smtp.localhost property. The property doesn't even appear 
anywher in the class.  First line in getLocalHost() pulls the 
InetAddress.getLocalHost().getHostName() value.

So half the problem is done... we know the culprit.  Now I guess (oh 
joy) I get to download the whole geronimo package, set up a build process, 
fix the code, and replace the jar on my server. (yuck).

That is... unless someone already has a VERY quick way to patch and rebuild 
geronimo.  Looking for volunteers :-)

In the meantime, I will also try adding that JVM parameter to try to override 
the Win Server machine name.

Still open to other suggestions for quicker workaround.

Thanks.

Jerry

-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org





-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5315 / Virus Database: 4189/8462 - Release Date: 10/27/14




-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org



Re: James 3 b4 HELO Override Not Working?

2014-10-27 Thread Robert Munn
Here is the base code. Note localHost is a property of the MailConnection 
class. Note also that there is a setLocalHost() method. I am going to try 
setting the localhost property from RemoteDelivery using setLocalHost( 
localHost ).

public String getLocalHost() throws MessagingException {
if (localHost == null) {

try {
localHost = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
// fine, we're misconfigured - ignore
}

if (localHost == null) {
localHost = props.getProperty(MAIL_LOCALHOST);
}

if (localHost == null) {
localHost = props.getSessionProperty(MAIL_LOCALHOST);
}

if (localHost == null) {
throw new MessagingException(Can't get local hostname. 
+  Please correctly configure JDK/DNS or set 
mail.smtp.localhost);
}
}

return localHost;
}


/**
 * Explicitly set the local host information.
 *
 * @param localHost
 *The new localHost name.
 */
public void setLocalHost(String localHost) {
this.localHost = localHost;
}




On Oct 27, 2014, at 11:28 AM, Jerry Malcolm techst...@malcolms.com wrote:

 mailet calls 'transport' which is an SMTPTransport instance. SMTPTransport 
 calls SMTPConnection.getLocalHost() which is inherited from 
 MailConnection.getLocalHost().
 
 That method returns the InetAddress().getLocalHost().getHostName() first.  
 According to the spec, that should only occur IF the property 
 mail.smtp.localhost is not set.  So i think the fix should be in that method.
 
 The very first thing in the MailConnection.getLocalHost()  method should be 
 something like:
 ---
 if ( props.getProperty( mail.smtp.localhost ) != null ) return( 
 props.getProperty( mail.smtp.localhost ));
 ---
 Then let it try all of the other options if and only if this property is NOT 
 set.
 
 Jerry
 
 On 10/27/2014 1:07 PM, Robert Munn wrote:
 More info. SMPTConnection.java extends MailConnection.java which has a 
 method with this signature:
 
   public boolean protocolConnect(String host, int port, String username, 
 String password) throws MessagingException
 
 If you fail to pass ‘host’ as an argument to the method, the host defaults 
 to ‘localhost’. A patch could be made there. A better patch would be to find 
 the upstream code that is calling this method and patch it to send the 
 correct hostname. I am hunting for that location, please let me know if you 
 have any suggestions...
 
 
 
 
 On Oct 27, 2014, at 10:25 AM, Jerry Malcolm techst...@malcolms.com wrote:
 
 Thanks for jumping in and investigating.  This has gone from ugly to 
 horrible  I think I have found the culprit.
 
 I first had to figure out who is providing the class for SMTPTransport.   
 figured out that the package for SMTPTransport is: 
 org.apache.geronimo.javamail.transport.smtp.  So it is NOT a base JVM 
 implementation It's apache, and I am about to withdraw my statement 
 that 'surely the transport class couldn't be ignoring a property.
 
 Geronimo's SMTPTransport.java uses a class SMTPConnection which actually 
 returns the localhost name.  And... no surprise at this point, it totally 
 ignores the mail.smtp.localhost property. The property doesn't even appear 
 anywher in the class.  First line in getLocalHost() pulls the 
 InetAddress.getLocalHost().getHostName() value.
 
 So half the problem is done... we know the culprit.  Now I guess (oh 
 joy) I get to download the whole geronimo package, set up a build 
 process, fix the code, and replace the jar on my server. (yuck).
 
 That is... unless someone already has a VERY quick way to patch and rebuild 
 geronimo.  Looking for volunteers :-)
 
 In the meantime, I will also try adding that JVM parameter to try to 
 override the Win Server machine name.
 
 Still open to other suggestions for quicker workaround.
 
 Thanks.
 
 Jerry
 
 -
 To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
 For additional commands, e-mail: server-user-h...@james.apache.org
 
 
 
 
 -
 No virus found in this message.
 Checked by AVG - www.avg.com
 Version: 2015.0.5315 / Virus Database: 4189/8462 - Release Date: 10/27/14
 
 
 
 -
 To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
 For additional commands, e-mail: server-user-h...@james.apache.org



Re: James 3 b4 HELO Override Not Working?

2014-10-27 Thread Jerry Malcolm
The mailet only sees 'transport' which is cast to generic 
javax.mail.Transport.   The localhost methods and connection methods 
are all part of the geronimo impl.  You'll need to cast the transport to 
the geronimo package for the class, then see if you can get the 
connection object from the transport.  Might work.  But non-trivial.  
I'll play around with that was well.


Jerry

On 10/27/2014 1:41 PM, Robert Munn wrote:

Here is the base code. Note localHost is a property of the MailConnection 
class. Note also that there is a setLocalHost() method. I am going to try 
setting the localhost property from RemoteDelivery using setLocalHost( 
localHost ).

 public String getLocalHost() throws MessagingException {
 if (localHost == null) {

 try {
 localHost = InetAddress.getLocalHost().getHostName();
 } catch (UnknownHostException e) {
 // fine, we're misconfigured - ignore
 }

 if (localHost == null) {
 localHost = props.getProperty(MAIL_LOCALHOST);
 }

 if (localHost == null) {
 localHost = props.getSessionProperty(MAIL_LOCALHOST);
 }

 if (localHost == null) {
 throw new MessagingException(Can't get local hostname. 
 +  Please correctly configure JDK/DNS or set 
mail.smtp.localhost);
 }
 }

 return localHost;
 }

 
 /**

  * Explicitly set the local host information.
  *
  * @param localHost
  *The new localHost name.
  */
 public void setLocalHost(String localHost) {
 this.localHost = localHost;
 }




On Oct 27, 2014, at 11:28 AM, Jerry Malcolm techst...@malcolms.com wrote:


mailet calls 'transport' which is an SMTPTransport instance. SMTPTransport 
calls SMTPConnection.getLocalHost() which is inherited from MailConnection.getLocalHost().

That method returns the InetAddress().getLocalHost().getHostName() first.  
According to the spec, that should only occur IF the property 
mail.smtp.localhost is not set.  So i think the fix should be in that method.

The very first thing in the MailConnection.getLocalHost()  method should be 
something like:
---
if ( props.getProperty( mail.smtp.localhost ) != null ) return( props.getProperty( 
mail.smtp.localhost ));
---
Then let it try all of the other options if and only if this property is NOT 
set.

Jerry

On 10/27/2014 1:07 PM, Robert Munn wrote:

More info. SMPTConnection.java extends MailConnection.java which has a method 
with this signature:

   public boolean protocolConnect(String host, int port, String username, 
String password) throws MessagingException

If you fail to pass ‘host’ as an argument to the method, the host defaults to 
‘localhost’. A patch could be made there. A better patch would be to find the 
upstream code that is calling this method and patch it to send the correct 
hostname. I am hunting for that location, please let me know if you have any 
suggestions...




On Oct 27, 2014, at 10:25 AM, Jerry Malcolm techst...@malcolms.com wrote:


Thanks for jumping in and investigating.  This has gone from ugly to 
horrible  I think I have found the culprit.

I first had to figure out who is providing the class for SMTPTransport.   figured 
out that the package for SMTPTransport is: 
org.apache.geronimo.javamail.transport.smtp.  So it is NOT a base JVM 
implementation It's apache, and I am about to withdraw my statement that 'surely 
the transport class couldn't be ignoring a property.

Geronimo's SMTPTransport.java uses a class SMTPConnection which actually 
returns the localhost name.  And... no surprise at this point, it totally 
ignores the mail.smtp.localhost property. The property doesn't even appear 
anywher in the class.  First line in getLocalHost() pulls the 
InetAddress.getLocalHost().getHostName() value.

So half the problem is done... we know the culprit.  Now I guess (oh 
joy) I get to download the whole geronimo package, set up a build process, 
fix the code, and replace the jar on my server. (yuck).

That is... unless someone already has a VERY quick way to patch and rebuild 
geronimo.  Looking for volunteers :-)

In the meantime, I will also try adding that JVM parameter to try to override 
the Win Server machine name.

Still open to other suggestions for quicker workaround.

Thanks.

Jerry

-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org




-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5315 / Virus Database: 4189/8462 - Release Date: 10/27/14



-
To unsubscribe, e-mail: 

Re: James 3 b4 HELO Override Not Working?

2014-10-27 Thread Robert Munn
I may have a good build, stand by. I got the transport cast as SMTPTransport. 
The code will need some polishing, let’s see first if it works.

On Oct 27, 2014, at 12:00 PM, Jerry Malcolm techst...@malcolms.com wrote:

 The mailet only sees 'transport' which is cast to generic 
 javax.mail.Transport.   The localhost methods and connection methods are 
 all part of the geronimo impl.  You'll need to cast the transport to the 
 geronimo package for the class, then see if you can get the connection object 
 from the transport.  Might work.  But non-trivial.  I'll play around with 
 that was well.
 
 Jerry
 
 On 10/27/2014 1:41 PM, Robert Munn wrote:
 Here is the base code. Note localHost is a property of the MailConnection 
 class. Note also that there is a setLocalHost() method. I am going to try 
 setting the localhost property from RemoteDelivery using setLocalHost( 
 localHost ).
 
 public String getLocalHost() throws MessagingException {
 if (localHost == null) {
 
 try {
 localHost = InetAddress.getLocalHost().getHostName();
 } catch (UnknownHostException e) {
 // fine, we're misconfigured - ignore
 }
 
 if (localHost == null) {
 localHost = props.getProperty(MAIL_LOCALHOST);
 }
 
 if (localHost == null) {
 localHost = props.getSessionProperty(MAIL_LOCALHOST);
 }
 
 if (localHost == null) {
 throw new MessagingException(Can't get local hostname. 
 +  Please correctly configure JDK/DNS or set 
 mail.smtp.localhost);
 }
 }
 
 return localHost;
 }
 
  /**
  * Explicitly set the local host information.
  *
  * @param localHost
  *The new localHost name.
  */
 public void setLocalHost(String localHost) {
 this.localHost = localHost;
 }
 
 
 
 
 On Oct 27, 2014, at 11:28 AM, Jerry Malcolm techst...@malcolms.com wrote:
 
 mailet calls 'transport' which is an SMTPTransport instance. 
 SMTPTransport calls SMTPConnection.getLocalHost() which is inherited from 
 MailConnection.getLocalHost().
 
 That method returns the InetAddress().getLocalHost().getHostName() first.  
 According to the spec, that should only occur IF the property 
 mail.smtp.localhost is not set.  So i think the fix should be in that 
 method.
 
 The very first thing in the MailConnection.getLocalHost()  method should be 
 something like:
 ---
 if ( props.getProperty( mail.smtp.localhost ) != null ) return( 
 props.getProperty( mail.smtp.localhost ));
 ---
 Then let it try all of the other options if and only if this property is 
 NOT set.
 
 Jerry
 
 On 10/27/2014 1:07 PM, Robert Munn wrote:
 More info. SMPTConnection.java extends MailConnection.java which has a 
 method with this signature:
 
   public boolean protocolConnect(String host, int port, String username, 
 String password) throws MessagingException
 
 If you fail to pass ‘host’ as an argument to the method, the host defaults 
 to ‘localhost’. A patch could be made there. A better patch would be to 
 find the upstream code that is calling this method and patch it to send 
 the correct hostname. I am hunting for that location, please let me know 
 if you have any suggestions...
 
 
 
 
 On Oct 27, 2014, at 10:25 AM, Jerry Malcolm techst...@malcolms.com wrote:
 
 Thanks for jumping in and investigating.  This has gone from ugly to 
 horrible  I think I have found the culprit.
 
 I first had to figure out who is providing the class for SMTPTransport.   
 figured out that the package for SMTPTransport is: 
 org.apache.geronimo.javamail.transport.smtp.  So it is NOT a base JVM 
 implementation It's apache, and I am about to withdraw my statement 
 that 'surely the transport class couldn't be ignoring a property.
 
 Geronimo's SMTPTransport.java uses a class SMTPConnection which actually 
 returns the localhost name.  And... no surprise at this point, it totally 
 ignores the mail.smtp.localhost property. The property doesn't even 
 appear anywher in the class.  First line in getLocalHost() pulls the 
 InetAddress.getLocalHost().getHostName() value.
 
 So half the problem is done... we know the culprit.  Now I guess (oh 
 joy) I get to download the whole geronimo package, set up a build 
 process, fix the code, and replace the jar on my server. (yuck).
 
 That is... unless someone already has a VERY quick way to patch and 
 rebuild geronimo.  Looking for volunteers :-)
 
 In the meantime, I will also try adding that JVM parameter to try to 
 override the Win Server machine name.
 
 Still open to other suggestions for quicker workaround.
 
 Thanks.
 
 Jerry
 
 -
 To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org

Re: James 3 b4 HELO Override Not Working?

2014-10-27 Thread Jerry Malcolm

Well, Robert, you get the prize It works (finally)!

Two changes required to RemoteDelivery mailet:

Add:
import org.apache.geronimo.javamail.transport.smtp.*;

Right after:
transport = session.getTransport(outgoingMailServer);

add:
((org.apache.geronimo.javamail.transport.smtp.SMTPTransport)transport).setLocalHost( 
mail.jwmhosting.com);


or be more generic and get the value from props.

The setLocalHost needs to be right after the object is instantiated 
since the HELO is sent on one of the first calls to transport.


This fixes it (thank you so much for your help).  But Geronimo is still 
not following the spec and honoring the property mail.smtp.localhost.  
It needs to be fixed in a subsequent release.


Basically everybody using James 3 needs to add this fix to the mailet, 
at least if running on a Windows server.  Or verify through 
mail-tester.com that the HELO is correct.  Going back to the orig 
problem, gmail was not delivering tons of my mail due to this.


Thanks again.

Now anybody offer any help on getting jDKIM working?  I've got it 
implemented and the DNS is set up.  But mail-tester is telling me the 
signature is invalid.  On to the next problem.


Jerry




On 10/27/2014 2:00 PM, Jerry Malcolm wrote:
The mailet only sees 'transport' which is cast to generic 
javax.mail.Transport.   The localhost methods and connection methods 
are all part of the geronimo impl.  You'll need to cast the transport 
to the geronimo package for the class, then see if you can get the 
connection object from the transport.  Might work.  But non-trivial.  
I'll play around with that was well.


Jerry

On 10/27/2014 1:41 PM, Robert Munn wrote:
Here is the base code. Note localHost is a property of the 
MailConnection class. Note also that there is a setLocalHost() 
method. I am going to try setting the localhost property from 
RemoteDelivery using setLocalHost( localHost ).


 public String getLocalHost() throws MessagingException {
 if (localHost == null) {

 try {
 localHost = InetAddress.getLocalHost().getHostName();
 } catch (UnknownHostException e) {
 // fine, we're misconfigured - ignore
 }

 if (localHost == null) {
 localHost = props.getProperty(MAIL_LOCALHOST);
 }

 if (localHost == null) {
 localHost = props.getSessionProperty(MAIL_LOCALHOST);
 }

 if (localHost == null) {
 throw new MessagingException(Can't get local 
hostname. 
 +  Please correctly configure JDK/DNS or 
set mail.smtp.localhost);

 }
 }

 return localHost;
 }

  /**
  * Explicitly set the local host information.
  *
  * @param localHost
  *The new localHost name.
  */
 public void setLocalHost(String localHost) {
 this.localHost = localHost;
 }




On Oct 27, 2014, at 11:28 AM, Jerry Malcolm techst...@malcolms.com 
wrote:


mailet calls 'transport' which is an SMTPTransport instance. 
SMTPTransport calls SMTPConnection.getLocalHost() which is inherited 
from MailConnection.getLocalHost().


That method returns the InetAddress().getLocalHost().getHostName() 
first.  According to the spec, that should only occur IF the 
property mail.smtp.localhost is not set.  So i think the fix should 
be in that method.


The very first thing in the MailConnection.getLocalHost() method 
should be something like:

---
if ( props.getProperty( mail.smtp.localhost ) != null ) return( 
props.getProperty( mail.smtp.localhost ));

---
Then let it try all of the other options if and only if this 
property is NOT set.


Jerry

On 10/27/2014 1:07 PM, Robert Munn wrote:
More info. SMPTConnection.java extends MailConnection.java which 
has a method with this signature:


   public boolean protocolConnect(String host, int port, String 
username, String password) throws MessagingException


If you fail to pass ‘host’ as an argument to the method, the host 
defaults to ‘localhost’. A patch could be made there. A better 
patch would be to find the upstream code that is calling this 
method and patch it to send the correct hostname. I am hunting for 
that location, please let me know if you have any suggestions...





On Oct 27, 2014, at 10:25 AM, Jerry Malcolm 
techst...@malcolms.com wrote:


Thanks for jumping in and investigating.  This has gone from ugly 
to horrible  I think I have found the culprit.


I first had to figure out who is providing the class for 
SMTPTransport.   figured out that the package for SMTPTransport 
is: org.apache.geronimo.javamail.transport.smtp.  So it is NOT a 
base JVM implementation It's apache, and I am about to 
withdraw my statement that 'surely the transport class couldn't be 
ignoring a property.


Geronimo's SMTPTransport.java 

Re: James 3 b4 HELO Override Not Working?

2014-10-27 Thread Robert Munn
Great stuff. I got the build working as well. I don’t like the fact that we’re 
forcing it to use SMTPTransport, ruling out using other transport providers, 
but if you look at the section of the code just below there, you see this:

// if the transport is a SMTPTransport (from sun) some
// performance enhancement can be done.
if (transport.getClass().getName().endsWith(.SMTPTransport)) {

so there is a section that is testing the class and adding extensions already. 
I might wrap the code in a class name check and only call setLocalHost() if I 
find org.apache.geronimo.javamail.transport.smtp.SMTPTransport. 

Also, you only need to import that class, not the entire 
org.apache.geronimo.javamail.transport.smtp.* package. Better for the memory 
footprint.


I will help with jDKIM, I will need to set it up myself. Where to start?



On Oct 27, 2014, at 12:29 PM, Jerry Malcolm techst...@malcolms.com wrote:

 Well, Robert, you get the prize It works (finally)!
 
 Two changes required to RemoteDelivery mailet:
 
 Add:
 import org.apache.geronimo.javamail.transport.smtp.*;
 
 Right after:
transport = session.getTransport(outgoingMailServer);
 
 add:
 ((org.apache.geronimo.javamail.transport.smtp.SMTPTransport)transport).setLocalHost(
  mail.jwmhosting.com);
 
 or be more generic and get the value from props.
 
 The setLocalHost needs to be right after the object is instantiated since the 
 HELO is sent on one of the first calls to transport.
 
 This fixes it (thank you so much for your help).  But Geronimo is still not 
 following the spec and honoring the property mail.smtp.localhost.  It needs 
 to be fixed in a subsequent release.
 
 Basically everybody using James 3 needs to add this fix to the mailet, at 
 least if running on a Windows server.  Or verify through mail-tester.com that 
 the HELO is correct.  Going back to the orig problem, gmail was not 
 delivering tons of my mail due to this.
 
 Thanks again.
 
 Now anybody offer any help on getting jDKIM working?  I've got it 
 implemented and the DNS is set up.  But mail-tester is telling me the 
 signature is invalid.  On to the next problem.
 
 Jerry
 
 
 
 
 On 10/27/2014 2:00 PM, Jerry Malcolm wrote:
 The mailet only sees 'transport' which is cast to generic 
 javax.mail.Transport.   The localhost methods and connection methods are 
 all part of the geronimo impl.  You'll need to cast the transport to the 
 geronimo package for the class, then see if you can get the connection 
 object from the transport.  Might work.  But non-trivial.  I'll play around 
 with that was well.
 
 Jerry
 
 On 10/27/2014 1:41 PM, Robert Munn wrote:
 Here is the base code. Note localHost is a property of the MailConnection 
 class. Note also that there is a setLocalHost() method. I am going to try 
 setting the localhost property from RemoteDelivery using setLocalHost( 
 localHost ).
 
 public String getLocalHost() throws MessagingException {
 if (localHost == null) {
 
 try {
 localHost = InetAddress.getLocalHost().getHostName();
 } catch (UnknownHostException e) {
 // fine, we're misconfigured - ignore
 }
 
 if (localHost == null) {
 localHost = props.getProperty(MAIL_LOCALHOST);
 }
 
 if (localHost == null) {
 localHost = props.getSessionProperty(MAIL_LOCALHOST);
 }
 
 if (localHost == null) {
 throw new MessagingException(Can't get local hostname. 
 +  Please correctly configure JDK/DNS or set 
 mail.smtp.localhost);
 }
 }
 
 return localHost;
 }
 
  /**
  * Explicitly set the local host information.
  *
  * @param localHost
  *The new localHost name.
  */
 public void setLocalHost(String localHost) {
 this.localHost = localHost;
 }
 
 
 
 
 On Oct 27, 2014, at 11:28 AM, Jerry Malcolm techst...@malcolms.com wrote:
 
 mailet calls 'transport' which is an SMTPTransport instance. 
 SMTPTransport calls SMTPConnection.getLocalHost() which is inherited from 
 MailConnection.getLocalHost().
 
 That method returns the InetAddress().getLocalHost().getHostName() first.  
 According to the spec, that should only occur IF the property 
 mail.smtp.localhost is not set.  So i think the fix should be in that 
 method.
 
 The very first thing in the MailConnection.getLocalHost() method should be 
 something like:
 ---
 if ( props.getProperty( mail.smtp.localhost ) != null ) return( 
 props.getProperty( mail.smtp.localhost ));
 ---
 Then let it try all of the other options if and only if this property is 
 NOT set.
 
 Jerry
 
 On 10/27/2014 1:07 PM, Robert Munn wrote:
 More info. SMPTConnection.java extends MailConnection.java which has a 
 method with this signature:
 
   public 

Re: James 3 b4 HELO Override Not Working?

2014-10-27 Thread Robert Munn
Here is my code. Import the SMTPTransport class, and replace this:

   transport = session.getTransport(outgoingMailServer);

with this:

   transport =  (SMTPTransport) session.getTransport(outgoingMailServer);
   transport.setLocalHost( props.getProperty(mail.smtp.localhost, heloName) );

I added:

  !-- Set the HELO/EHLO name to use when connectiong to remote 
SMTP-Server --
  mail.smtp.localhostmail.legacyavatar.com/mail.smtp.localhost

and I have confirmed that it is being picked up by 
props.getProperty(“mail.smtp.localhost”).




On Oct 27, 2014, at 1:23 PM, Robert Munn cfmuns...@gmail.com wrote:

 Great stuff. I got the build working as well. I don’t like the fact that 
 we’re forcing it to use SMTPTransport, ruling out using other transport 
 providers, but if you look at the section of the code just below there, you 
 see this:
 
// if the transport is a SMTPTransport (from sun) some
// performance enhancement can be done.
if (transport.getClass().getName().endsWith(.SMTPTransport)) {
 
 so there is a section that is testing the class and adding extensions 
 already. I might wrap the code in a class name check and only call 
 setLocalHost() if I find 
 org.apache.geronimo.javamail.transport.smtp.SMTPTransport. 
 
 Also, you only need to import that class, not the entire 
 org.apache.geronimo.javamail.transport.smtp.* package. Better for the memory 
 footprint.
 
 
 I will help with jDKIM, I will need to set it up myself. Where to start?
 
 
 
 On Oct 27, 2014, at 12:29 PM, Jerry Malcolm techst...@malcolms.com wrote:
 
 Well, Robert, you get the prize It works (finally)!
 
 Two changes required to RemoteDelivery mailet:
 
 Add:
 import org.apache.geronimo.javamail.transport.smtp.*;
 
 Right after:
   transport = session.getTransport(outgoingMailServer);
 
 add:
 ((org.apache.geronimo.javamail.transport.smtp.SMTPTransport)transport).setLocalHost(
  mail.jwmhosting.com);
 
 or be more generic and get the value from props.
 
 The setLocalHost needs to be right after the object is instantiated since 
 the HELO is sent on one of the first calls to transport.
 
 This fixes it (thank you so much for your help).  But Geronimo is still not 
 following the spec and honoring the property mail.smtp.localhost.  It needs 
 to be fixed in a subsequent release.
 
 Basically everybody using James 3 needs to add this fix to the mailet, at 
 least if running on a Windows server.  Or verify through mail-tester.com 
 that the HELO is correct.  Going back to the orig problem, gmail was not 
 delivering tons of my mail due to this.
 
 Thanks again.
 
 Now anybody offer any help on getting jDKIM working?  I've got it 
 implemented and the DNS is set up.  But mail-tester is telling me the 
 signature is invalid.  On to the next problem.
 
 Jerry
 
 
 
 
 On 10/27/2014 2:00 PM, Jerry Malcolm wrote:
 The mailet only sees 'transport' which is cast to generic 
 javax.mail.Transport.   The localhost methods and connection methods are 
 all part of the geronimo impl.  You'll need to cast the transport to the 
 geronimo package for the class, then see if you can get the connection 
 object from the transport.  Might work.  But non-trivial.  I'll play around 
 with that was well.
 
 Jerry
 
 On 10/27/2014 1:41 PM, Robert Munn wrote:
 Here is the base code. Note localHost is a property of the MailConnection 
 class. Note also that there is a setLocalHost() method. I am going to try 
 setting the localhost property from RemoteDelivery using setLocalHost( 
 localHost ).
 
public String getLocalHost() throws MessagingException {
if (localHost == null) {
 
try {
localHost = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
// fine, we're misconfigured - ignore
}
 
if (localHost == null) {
localHost = props.getProperty(MAIL_LOCALHOST);
}
 
if (localHost == null) {
localHost = props.getSessionProperty(MAIL_LOCALHOST);
}
 
if (localHost == null) {
throw new MessagingException(Can't get local hostname. 
+  Please correctly configure JDK/DNS or set 
 mail.smtp.localhost);
}
}
 
return localHost;
}
 
 /**
 * Explicitly set the local host information.
 *
 * @param localHost
 *The new localHost name.
 */
public void setLocalHost(String localHost) {
this.localHost = localHost;
}
 
 
 
 
 On Oct 27, 2014, at 11:28 AM, Jerry Malcolm techst...@malcolms.com wrote:
 
 mailet calls 'transport' which is an SMTPTransport instance. 
 SMTPTransport calls SMTPConnection.getLocalHost() which is inherited from 
 MailConnection.getLocalHost().
 
 That method returns the InetAddress().getLocalHost().getHostName() first. 
  According to the spec, that should only 

Re: James 3 b4 HELO Override Not Working?

2014-10-27 Thread Robert Munn
Forgot one thing. Just above the try{} block, Transport transport is defined. I 
changed it to this:

SMTPTransport transport = null;



On Oct 27, 2014, at 1:54 PM, Robert Munn cfmuns...@gmail.com wrote:

 Here is my code. Import the SMTPTransport class, and replace this:
 
   transport = session.getTransport(outgoingMailServer);
 
 with this:
 
   transport =  (SMTPTransport) session.getTransport(outgoingMailServer);
   transport.setLocalHost( props.getProperty(mail.smtp.localhost, heloName) 
 );
 
 I added:
 
  !-- Set the HELO/EHLO name to use when connectiong to remote 
 SMTP-Server --
  mail.smtp.localhostmail.legacyavatar.com/mail.smtp.localhost
 
 and I have confirmed that it is being picked up by 
 props.getProperty(“mail.smtp.localhost”).
 
 
 
 
 On Oct 27, 2014, at 1:23 PM, Robert Munn cfmuns...@gmail.com wrote:
 
 Great stuff. I got the build working as well. I don’t like the fact that 
 we’re forcing it to use SMTPTransport, ruling out using other transport 
 providers, but if you look at the section of the code just below there, you 
 see this:
 
   // if the transport is a SMTPTransport (from sun) some
   // performance enhancement can be done.
   if (transport.getClass().getName().endsWith(.SMTPTransport)) {
 
 so there is a section that is testing the class and adding extensions 
 already. I might wrap the code in a class name check and only call 
 setLocalHost() if I find 
 org.apache.geronimo.javamail.transport.smtp.SMTPTransport. 
 
 Also, you only need to import that class, not the entire 
 org.apache.geronimo.javamail.transport.smtp.* package. Better for the memory 
 footprint.
 
 
 I will help with jDKIM, I will need to set it up myself. Where to start?
 
 
 
 On Oct 27, 2014, at 12:29 PM, Jerry Malcolm techst...@malcolms.com wrote:
 
 Well, Robert, you get the prize It works (finally)!
 
 Two changes required to RemoteDelivery mailet:
 
 Add:
 import org.apache.geronimo.javamail.transport.smtp.*;
 
 Right after:
  transport = session.getTransport(outgoingMailServer);
 
 add:
 ((org.apache.geronimo.javamail.transport.smtp.SMTPTransport)transport).setLocalHost(
  mail.jwmhosting.com);
 
 or be more generic and get the value from props.
 
 The setLocalHost needs to be right after the object is instantiated since 
 the HELO is sent on one of the first calls to transport.
 
 This fixes it (thank you so much for your help).  But Geronimo is still not 
 following the spec and honoring the property mail.smtp.localhost.  It needs 
 to be fixed in a subsequent release.
 
 Basically everybody using James 3 needs to add this fix to the mailet, at 
 least if running on a Windows server.  Or verify through mail-tester.com 
 that the HELO is correct.  Going back to the orig problem, gmail was not 
 delivering tons of my mail due to this.
 
 Thanks again.
 
 Now anybody offer any help on getting jDKIM working?  I've got it 
 implemented and the DNS is set up.  But mail-tester is telling me the 
 signature is invalid.  On to the next problem.
 
 Jerry
 
 
 
 
 On 10/27/2014 2:00 PM, Jerry Malcolm wrote:
 The mailet only sees 'transport' which is cast to generic 
 javax.mail.Transport.   The localhost methods and connection methods are 
 all part of the geronimo impl.  You'll need to cast the transport to the 
 geronimo package for the class, then see if you can get the connection 
 object from the transport.  Might work.  But non-trivial.  I'll play 
 around with that was well.
 
 Jerry
 
 On 10/27/2014 1:41 PM, Robert Munn wrote:
 Here is the base code. Note localHost is a property of the MailConnection 
 class. Note also that there is a setLocalHost() method. I am going to try 
 setting the localhost property from RemoteDelivery using setLocalHost( 
 localHost ).
 
   public String getLocalHost() throws MessagingException {
   if (localHost == null) {
 
   try {
   localHost = InetAddress.getLocalHost().getHostName();
   } catch (UnknownHostException e) {
   // fine, we're misconfigured - ignore
   }
 
   if (localHost == null) {
   localHost = props.getProperty(MAIL_LOCALHOST);
   }
 
   if (localHost == null) {
   localHost = props.getSessionProperty(MAIL_LOCALHOST);
   }
 
   if (localHost == null) {
   throw new MessagingException(Can't get local hostname. 
   +  Please correctly configure JDK/DNS or set 
 mail.smtp.localhost);
   }
   }
 
   return localHost;
   }
 
/**
* Explicitly set the local host information.
*
* @param localHost
*The new localHost name.
*/
   public void setLocalHost(String localHost) {
   this.localHost = localHost;
   }
 
 
 
 
 On Oct 27, 2014, at 11:28 AM, Jerry Malcolm techst...@malcolms.com 
 wrote:
 
 mailet calls 'transport' which is an SMTPTransport instance. 
 SMTPTransport calls SMTPConnection.getLocalHost() which 

jDKIM Signature is invalid

2014-10-27 Thread Jerry Malcolm
With the HELO problem finally resolved and behind me, I'm on to the next 
issue that mail-tester.com is yelling at me about.  It say my DKIM 
signature is invalid.  I have tried replacing the public/private keys in 
my DNS and in the mailet config.  I've tried different syntax options 
for the DNS record, etc.  Still nothing. Normally, I would assume that 
it's something I'm doing wrong.  But after the HELO problem, I first 
want to verify that others are indeed using jDKIM with James 3 b5 
successfully.  (BTW... I said last night in a post that I'm on b4 
incorrect... i'm on b5).


My dns server is ISC BIND.  I'm assuming that could make a difference 
with defining the dkim public key in the dns record.


Is anyone using this successfully?

Here's the latest report I get from mail-tester.com:



The DKIM signature of your message is:

v=1;
d=jwmhosting.com;

b=ST3jn85HmyWjjPoIxojUKGMMCvtFzlrgqJiVwZ/bd5bzZuVWK/gviYIBXHFuc1iTZ/0NHdGW0TgRk9E7tRsXXPYM4yOP9zna7WTDC20VrsBu/LQbyktpsINAbRDzJbaNmSGjcLlAUODnaFLJPpwktpNkJu4EbFtKyYT3Exb4mfs=;
s=primary;
a=rsa-sha256;
bh=g3zLYH4xKxcPrHOD18z9YfpQcnk/GaJedfustWU5uGs=;
h=from:to:received:received;


Your public key is:

k=rsa;
p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDfRF6NEFFahhyOSiy+ufRU6PMvUVzP31wJ16zNaLKG8ipL1S8rIDr7ZjkGiUdwqZ6BjNTddbmcH4AxTupNhANyXvJs+MxyJbMN3mkYHYn1evJGVqT85DrM7XrYMSVPK3Y4dfY4vhokQwATv+BwrW7K8QuwrDgvu8JdxM0muS/7lQIDAQAB

Key length: 1024bits

Your DKIM signature is not valid

==

from my mailet config file:

 mailet match=All class=org.apache.james.jdkim.mailets.ConvertTo7Bit/

 mailet match=All class=org.apach1e.james.jdkim.mailets.DKIMSign
signatureTemplatev=1; s=primary; d=jwmhosting.com; 
h=from:to:received:received; a=rsa-sha256; bh=; b=;/signatureTemplate


privateKey
-BEGIN RSA PRIVATE KEY-
MIICXgIBAAKBgQDfRF6NEFFahhyOSiy+ufRU6PMvUVzP31wJ16zNaLKG8ipL1S8r
IDr7ZjkGiUdwqZ6BjNTddbmcH4AxTupNhANyXvJs+MxyJbMN3mkYHYn1evJGVqT8
...etc
...etc
ASnFebXvbrI3MQzrvgz3AkEAs1Tn0TfzsKmri6zrqJak1EDojHPdbPAjEFCpunt4
+dRCWhtnwEGZ1REeEBiQsk9CM24VNknO0uJOKF3ZYb3lFA==
-END RSA PRIVATE KEY-
/privateKey
  /mailet


Help??

Thx again.

Jerry

-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org



Re: James 3 b4 HELO Override Not Working?

2014-10-27 Thread Robert Munn
OK, I made an Eclipse patch for the RemoteDelivery issue. I also made a patch 
for a mod I made to ReadOnlyUsersLDAPRespository.java that filters LDAP users 
by an additional filter string specified in the ldap conf file. Details, and 
patches, available on my blog:

http://blog.bonnydoonmedia.com/post.cfm/patches-for-apache-james-mail-server-3-0-beta5



On Oct 27, 2014, at 2:05 PM, Robert Munn cfmuns...@gmail.com wrote:

 Forgot one thing. Just above the try{} block, Transport transport is defined. 
 I changed it to this:
 
 SMTPTransport transport = null;
 
 
 
 On Oct 27, 2014, at 1:54 PM, Robert Munn cfmuns...@gmail.com wrote:
 
 Here is my code. Import the SMTPTransport class, and replace this:
 
  transport = session.getTransport(outgoingMailServer);
 
 with this:
 
  transport =  (SMTPTransport) session.getTransport(outgoingMailServer);
  transport.setLocalHost( props.getProperty(mail.smtp.localhost, heloName) 
 );
 
 I added:
 
 !-- Set the HELO/EHLO name to use when connectiong to remote 
 SMTP-Server --
 mail.smtp.localhostmail.legacyavatar.com/mail.smtp.localhost
 
 and I have confirmed that it is being picked up by 
 props.getProperty(“mail.smtp.localhost”).
 
 
 
 
 On Oct 27, 2014, at 1:23 PM, Robert Munn cfmuns...@gmail.com wrote:
 
 Great stuff. I got the build working as well. I don’t like the fact that 
 we’re forcing it to use SMTPTransport, ruling out using other transport 
 providers, but if you look at the section of the code just below there, you 
 see this:
 
  // if the transport is a SMTPTransport (from sun) some
  // performance enhancement can be done.
  if (transport.getClass().getName().endsWith(.SMTPTransport)) {
 
 so there is a section that is testing the class and adding extensions 
 already. I might wrap the code in a class name check and only call 
 setLocalHost() if I find 
 org.apache.geronimo.javamail.transport.smtp.SMTPTransport. 
 
 Also, you only need to import that class, not the entire 
 org.apache.geronimo.javamail.transport.smtp.* package. Better for the 
 memory footprint.
 
 
 I will help with jDKIM, I will need to set it up myself. Where to start?
 
 
 
 On Oct 27, 2014, at 12:29 PM, Jerry Malcolm techst...@malcolms.com wrote:
 
 Well, Robert, you get the prize It works (finally)!
 
 Two changes required to RemoteDelivery mailet:
 
 Add:
 import org.apache.geronimo.javamail.transport.smtp.*;
 
 Right after:
 transport = session.getTransport(outgoingMailServer);
 
 add:
 ((org.apache.geronimo.javamail.transport.smtp.SMTPTransport)transport).setLocalHost(
  mail.jwmhosting.com);
 
 or be more generic and get the value from props.
 
 The setLocalHost needs to be right after the object is instantiated since 
 the HELO is sent on one of the first calls to transport.
 
 This fixes it (thank you so much for your help).  But Geronimo is still 
 not following the spec and honoring the property mail.smtp.localhost.  It 
 needs to be fixed in a subsequent release.
 
 Basically everybody using James 3 needs to add this fix to the mailet, at 
 least if running on a Windows server.  Or verify through mail-tester.com 
 that the HELO is correct.  Going back to the orig problem, gmail was not 
 delivering tons of my mail due to this.
 
 Thanks again.
 
 Now anybody offer any help on getting jDKIM working?  I've got it 
 implemented and the DNS is set up.  But mail-tester is telling me the 
 signature is invalid.  On to the next problem.
 
 Jerry
 
 
 
 
 On 10/27/2014 2:00 PM, Jerry Malcolm wrote:
 The mailet only sees 'transport' which is cast to generic 
 javax.mail.Transport.   The localhost methods and connection methods 
 are all part of the geronimo impl.  You'll need to cast the transport to 
 the geronimo package for the class, then see if you can get the 
 connection object from the transport.  Might work.  But non-trivial.  
 I'll play around with that was well.
 
 Jerry
 
 On 10/27/2014 1:41 PM, Robert Munn wrote:
 Here is the base code. Note localHost is a property of the 
 MailConnection class. Note also that there is a setLocalHost() method. I 
 am going to try setting the localhost property from RemoteDelivery using 
 setLocalHost( localHost ).
 
  public String getLocalHost() throws MessagingException {
  if (localHost == null) {
 
  try {
  localHost = InetAddress.getLocalHost().getHostName();
  } catch (UnknownHostException e) {
  // fine, we're misconfigured - ignore
  }
 
  if (localHost == null) {
  localHost = props.getProperty(MAIL_LOCALHOST);
  }
 
  if (localHost == null) {
  localHost = props.getSessionProperty(MAIL_LOCALHOST);
  }
 
  if (localHost == null) {
  throw new MessagingException(Can't get local hostname. 
  +  Please correctly configure JDK/DNS or set 
 mail.smtp.localhost);
  }
  }
 
  return localHost;
  }
 
   /**
   * 

Re: James 3 b4 HELO Override Not Working?

2014-10-27 Thread Robert Munn
A couple of additional notes. This issue appeared on Ubuntu as well, so it
is not just a windows issue.

On the  good side, the version of Geronimo java mail in the app is fairly
old, so this bug may be fixed already.
On Oct 27, 2014 12:29 PM, Jerry Malcolm techst...@malcolms.com wrote:

 Well, Robert, you get the prize It works (finally)!

 Two changes required to RemoteDelivery mailet:

 Add:
 import org.apache.geronimo.javamail.transport.smtp.*;

 Right after:
 transport = session.getTransport(outgoingMailServer);

 add:
 ((org.apache.geronimo.javamail.transport.smtp.SMTPTransport)transport).setLocalHost(
 mail.jwmhosting.com);

 or be more generic and get the value from props.

 The setLocalHost needs to be right after the object is instantiated since
 the HELO is sent on one of the first calls to transport.

 This fixes it (thank you so much for your help).  But Geronimo is still
 not following the spec and honoring the property mail.smtp.localhost.  It
 needs to be fixed in a subsequent release.

 Basically everybody using James 3 needs to add this fix to the mailet, at
 least if running on a Windows server.  Or verify through mail-tester.com
 that the HELO is correct.  Going back to the orig problem, gmail was not
 delivering tons of my mail due to this.

 Thanks again.

 Now anybody offer any help on getting jDKIM working?  I've got it
 implemented and the DNS is set up.  But mail-tester is telling me the
 signature is invalid.  On to the next problem.

 Jerry




 On 10/27/2014 2:00 PM, Jerry Malcolm wrote:

 The mailet only sees 'transport' which is cast to generic
 javax.mail.Transport.   The localhost methods and connection methods are
 all part of the geronimo impl.  You'll need to cast the transport to the
 geronimo package for the class, then see if you can get the connection
 object from the transport.  Might work.  But non-trivial.  I'll play around
 with that was well.

 Jerry

 On 10/27/2014 1:41 PM, Robert Munn wrote:

 Here is the base code. Note localHost is a property of the
 MailConnection class. Note also that there is a setLocalHost() method. I am
 going to try setting the localhost property from RemoteDelivery using
 setLocalHost( localHost ).

  public String getLocalHost() throws MessagingException {
  if (localHost == null) {

  try {
  localHost = InetAddress.getLocalHost().getHostName();
  } catch (UnknownHostException e) {
  // fine, we're misconfigured - ignore
  }

  if (localHost == null) {
  localHost = props.getProperty(MAIL_LOCALHOST);
  }

  if (localHost == null) {
  localHost = props.getSessionProperty(MAIL_LOCALHOST);
  }

  if (localHost == null) {
  throw new MessagingException(Can't get local hostname.
 
  +  Please correctly configure JDK/DNS or set
 mail.smtp.localhost);
  }
  }

  return localHost;
  }

   /**
   * Explicitly set the local host information.
   *
   * @param localHost
   *The new localHost name.
   */
  public void setLocalHost(String localHost) {
  this.localHost = localHost;
  }




 On Oct 27, 2014, at 11:28 AM, Jerry Malcolm techst...@malcolms.com
 wrote:

  mailet calls 'transport' which is an SMTPTransport instance.
 SMTPTransport calls SMTPConnection.getLocalHost() which is inherited from
 MailConnection.getLocalHost().

 That method returns the InetAddress().getLocalHost().getHostName()
 first.  According to the spec, that should only occur IF the property
 mail.smtp.localhost is not set.  So i think the fix should be in that
 method.

 The very first thing in the MailConnection.getLocalHost() method should
 be something like:
 ---
 if ( props.getProperty( mail.smtp.localhost ) != null ) return(
 props.getProperty( mail.smtp.localhost ));
 ---
 Then let it try all of the other options if and only if this property
 is NOT set.

 Jerry

 On 10/27/2014 1:07 PM, Robert Munn wrote:

 More info. SMPTConnection.java extends MailConnection.java which has a
 method with this signature:

public boolean protocolConnect(String host, int port, String
 username, String password) throws MessagingException

 If you fail to pass ‘host’ as an argument to the method, the host
 defaults to ‘localhost’. A patch could be made there. A better patch would
 be to find the upstream code that is calling this method and patch it to
 send the correct hostname. I am hunting for that location, please let me
 know if you have any suggestions...




 On Oct 27, 2014, at 10:25 AM, Jerry Malcolm techst...@malcolms.com
 wrote:

  Thanks for jumping in and investigating.  This has gone from ugly to
 horrible  I think I have found the culprit.

 I first had to figure out who is