ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | shark List | May 2005 Index

<--  Date Index  --> <--  Thread Index  -->

Enhanced SMTPEventAuditManager


Hi all,
I have enhanced the SMTPEventAuditManager to use Authentication only, when 
the .Auth property is set. This will allow you to send mail through SMTP 
severs which do not require Authentication.
I also changed replacing the {foo} tokens to using String.replaceAll() - 
But since I think, that you don't want to be dependent on Java 1.4, you 
probably want to delete the last 16 lines of the patch. I had to change 
that, because my MiscUtilities class (from 1.0) does not have a 
replaceAll() method.
Patch is below.
Hope this will be integrated with Shark.

cheers,
Till


115,125c115,131
<          props.put("mail.smtp.user", auth);
<          props.put("mail.smtp.auth", "true");
<          // Get session
<          javax.mail.Session session = Session.getInstance(props,
<                                                           new 
Authenticator() {
<                                                              public 
PasswordAuthentication getPasswordAuthentication() {
<                                                                 return 
new PasswordAuthentication(auth,
<                          cus.getProperty(_PARAM_PREFIX
<                                          + _PARAM_PASSWD));
<                                                              }
<                                                           });
---
>          javax.mail.Session session;
>          if (auth.equals("")) {
>               session = Session.getInstance(props);
>          } else {
>             props.put("mail.smtp.user", auth);
>             props.put("mail.smtp.auth", "true");
>             // Get session
>             session = Session.getInstance(props,
>                                           new Authenticator() {
>                                              public 
PasswordAuthentication getPasswordAuthentication() {
>                                                 return new 
PasswordAuthentication(auth,
>          cus.getProperty(_PARAM_PREFIX
>                          + _PARAM_PASSWD));
>                                                                 }
>                                                              });
> 
>          }
198c204
<          ret = MiscUtilities.replaceAll(ret, "{person}", person);
---
>          ret = ret.replaceAll("\\{person\\}", person);
201c207
<          ret = MiscUtilities.replaceAll(ret, "{activity}", activity);
---
>          ret = ret.replaceAll("\\{activity\\}", activity);
204c210
<          ret = MiscUtilities.replaceAll(ret, "{process}", process);
---
>          ret = ret.replaceAll("\\{process\\}", process);
207c213
<          ret = MiscUtilities.replaceAll(ret, "{definition}", 
definition);
---
>          ret = ret.replaceAll("\\{definition\\}", definition);



<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.