setting up log4j for gmail, does not recognize System.setProperty("mail.smtps.port", "587")

Posted by Alex Le on Stack Overflow See other posts from Stack Overflow or by Alex Le
Published on 2010-04-10T00:37:37Z Indexed on 2010/04/10 0:43 UTC
Read the original article Hit count: 336

Filed under:
|
|

Hi

I am trying to setup a smtpappender for log4j using gmail as the smtp host.

I have read that the port number needs to be 465 or 587 (depending on tls or ssl) and that log4j for some reason doesnt allow a different port to be set inside log4j.properties configuration file.

I have read that the best way of doing this would be to use System.setProperty which would change the default javaxmail port to gmail.

However when I try to set the System.property entries the the default port still remains as 25

System.setProperty("mail.smtp.starttls.enable", "true"); System.setProperty("mail.smtp.port", "587");

I was wondering if someone could help me out, I am open to suggestions, I just need to smtpAppender to work for gmail, dont really care how to get it to work.

Thanks

© Stack Overflow or respective owner

Related posts about log4j

Related posts about smtp