commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian K. Wallace" <br...@transmorphix.com>
Subject Re: [email] Using Templates for Mail Message
Date Fri, 02 Dec 2005 09:40:43 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The problem I would see with having this in email, even as a utility, is
that it isn't e-mail specific.

While your use case deals with the file system and (presumably?) a
bean-type substitution (e.g., @@LOGIN@@, user.getLogin()), there is a
broader scope of retrieval of information from other sources (database,
property files, etc). The use cases (and dependencies to match) could
get well out of control for a simple project aimed at making e-mail
easier to use.

Perhaps a utility class for your use case could simply deal with
String's replace/replaceAll?

Brian

Herak Sen wrote:
> Hi!
>   Thanks for writing back
>   I agree that it won't be part of the core Email project,but as helpers or utils.
>   Please comment.
> Thanks
>   Herak
> 
> "Brian K. Wallace" <brian@transmorphix.com> wrote:
>   -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Herak Sen wrote:
>> Hi,
>> A very common method which I use for setting messages is by loading from an external
file and replace some tokens with desired values.
>> For e.g.
>> ------------------------------------------------------------------
>> AUTO-GENERATED MESSAGE FOLLOWS. PLEASE DO NOT REPLY TO THIS EMAIL.
>> -------------------------------------------------------------------
>> Hello,
>> You have been successfully registered.
>> Login Detail 
>> login :@LOGIN@
>> pwd :@PWD@
>> -----------------------------------------------------------------
>> After reading this file, I replace @LOGIN@ and @PWD@ with the appropriate values
and then send the contents.
>> I was wondering whether such feature could be incorporated in API. 
>> There could be a class something like the following
>> public class Template{
>> private String template;
>> public Template(InputStream in){
>> template=loadTemplate(in);
>> }
>> public String replaceTokens(Map map){
>> //Replace all string within @@
>> return template;
>> }
>> }
>>
>> May be have a more sophisticated implementation for various data sources.
>> Please share your views.
>>
>> Thanks
>> Herak
> 
> This appears to me to be outside the realm of [email] itself. Not
> discounting the number of times this type of templating is performed -
> just seems outside the scope of the email project.
> 
> 
> My .02
> 
> Brian

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)

iD8DBQFDkBabaCoPKRow/gARAu9TAKDlpgsI+ifuml0mvXdLTwGo440ckwCdHKK7
0wRZN2bjetPh2whN/8K+eNk=
=/ART
-----END PGP SIGNATURE-----

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


Mime
View raw message