RE: [OT] Sending email from struts
On our sites we are using taglibs-mailer which is very simple and sends mail using tags embedded in a jsp. This makes it very simple to have the jsp render out some dynamic bean information in to the page and have the contents of that page be mailed as the mail body. Chris -Original Message- From: Matt Bathje [mailto:[EMAIL PROTECTED] Sent: 11 February 2004 16:03 To: strutslist Subject: [OT] Sending email from struts Hi all. This is kind of off topic as it is not really struts related, but somebody here would probably have the answer. We have our application sending emails to users at some points and it is working fine. The problem is that we have the email message hardcoded into the Java, which we would like to avoid either by storing the message in application.properties or our database. This would be easy, except all of the messages contain user-specific information like their name or phone number or order id or something like that. Anybody have any ideas (or links to programs!) that can read in an email, replace the information it needs to from the db, and send that to the user. I could obviously write something myself to do it, but wouldn't want to reinvent the wheel. Turns out this is hard to search for too - email is not a search term that makes things easy. Thanks, Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] *** This e-mail and its attachments are confidential and are intended for the above named recipient only. If this has come to you in error, please notify the sender immediately and delete this e-mail from your system. You must take no action based on this, nor must you copy or disclose it or any part of its contents to any person or organisation. Statements and opinions contained in this email may not necessarily represent those of Littlewoods. Please note that e-mail communications may be monitored. The registered office of Littlewoods Limited and its subsidiaries is 100 Old Hall Street, Liverpool, L70 1AB. Registered number of Littlewoods Limited is 262152. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Sending email from struts
Hi, Have a look at Velocity (Jakarta), templating engine. You can use that to substitute the user details and form the mail message. The template could just be a resourse file with velocity tags. Cheers Sachin - Original Message - From: "Matt Bathje" <[EMAIL PROTECTED]> To: "strutslist" <[EMAIL PROTECTED]> Sent: Thursday, February 12, 2004 3:02 AM Subject: [OT] Sending email from struts > Hi all. > > This is kind of off topic as it is not really struts related, but somebody > here would probably have the answer. > > We have our application sending emails to users at some points and it is > working fine. The problem is that we have the email message hardcoded into > the Java, which we would like to avoid either by storing the message in > application.properties or our database. This would be easy, except all of > the messages contain user-specific information like their name or phone > number or order id or something like that. > > Anybody have any ideas (or links to programs!) that can read in an email, > replace the information it needs to from the db, and send that to the user. > > I could obviously write something myself to do it, but wouldn't want to > reinvent the wheel. > > Turns out this is hard to search for too - email is not a search term that > makes things easy. > > Thanks, > Matt Bathje > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Sending email from struts
Matt, we ended up storing our email templates in a configuration file and loading them into memory (using Digester) at application run time. The configuration templates can contain both plain text and HTML message versions. We leverage the java.text.MessageFormat API to replace place holders in the templates with actual data. In the application, we use a design pattern called EmailHelper. EmailHelper provides a business API to which the application passes information. For example, after a customer downloads a product, the application might do something like: EmailHelper.getInstance().sendThankYouMessage(user, product); where user and product are application data structures respectively representing the current user and the product which was just downloaded. Subsequently, EmailHelper mines the necessary data from the arguments and then performs lower level operations such as retrieving the appropriate email template from the in memory configurations, populating the template and then persisting the email to the appropriate queue where it will be delivered later. A different application (daemon) periodically retrieves unsent email from the queue and sends them using the JavaMail API. It has worked quite well so far. If we need to tweak the templates, we can do so and reload the configurations. You could take this idea a step further and store the templates in the database. This does seem like a common task in applications and it would be nice if there were some standard framework to use, but I don't know of any in development currently. robert > -Original Message- > From: Matt Bathje [mailto:[EMAIL PROTECTED] > Sent: Wednesday, February 11, 2004 11:03 AM > To: strutslist > Subject: [OT] Sending email from struts > > > Hi all. > > This is kind of off topic as it is not really struts related, but somebody > here would probably have the answer. > > We have our application sending emails to users at some points and it is > working fine. The problem is that we have the email message hardcoded into > the Java, which we would like to avoid either by storing the message in > application.properties or our database. This would be easy, except all of > the messages contain user-specific information like their name or phone > number or order id or something like that. > > Anybody have any ideas (or links to programs!) that can read in an email, > replace the information it needs to from the db, and send that to > the user. > > I could obviously write something myself to do it, but wouldn't want to > reinvent the wheel. > > Turns out this is hard to search for too - email is not a search term that > makes things easy. > > Thanks, > Matt Bathje > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Sending email from struts
You might want to try something like velocity so you can store the text of the e-mail as a template and use velocity to insert the dynamic content. If there are really only a few simple fields, I would store the text in the database or an xml file and then use a simple string replace routine to replace tags like {ORDER_ID} and {USER_NAME} with the order id and user name before passing that message to the mailer. -Rob -Original Message- From: Matt Bathje [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 11, 2004 11:03 AM To: strutslist Subject: [OT] Sending email from struts Hi all. This is kind of off topic as it is not really struts related, but somebody here would probably have the answer. We have our application sending emails to users at some points and it is working fine. The problem is that we have the email message hardcoded into the Java, which we would like to avoid either by storing the message in application.properties or our database. This would be easy, except all of the messages contain user-specific information like their name or phone number or order id or something like that. Anybody have any ideas (or links to programs!) that can read in an email, replace the information it needs to from the db, and send that to the user. I could obviously write something myself to do it, but wouldn't want to reinvent the wheel. Turns out this is hard to search for too - email is not a search term that makes things easy. Thanks, Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Sending email from struts
We also use the velocity template engine and it has worked like a charm. During initial development we simply sent a Hashmap of variable values to the Template helper class we created ( and created very rudimentary emails for testing) when the system was ready to go into production the end users simply updated the templates to format the emails to look like they wanted and saved and everything worked out great. -Original Message- From: Tim Kettering [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 11, 2004 10:10 AM To: 'Struts Users Mailing List' Subject: RE: [OT] Sending email from struts For our project, what we're using is Velocity. I wrote up a simple velocity utility class that would take a velocity template, a hashmap of values, and return the formatted string, and then use that string for the mail body. Then you can keep your velocity files (.vm) in the classpath, and fetch them via the classloader. It works pretty good. I would imagine that you could take it a bit further and store the velocity text in the database instead. The other option is to use the mailer taglib on a jsp page, but I found that it was distruptive in terms of workflow if you want to do a forward to a page while sending a email, like a password reminder workflow, etc. -tim -Original Message- From: Samyukta Akunuru [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 11, 2004 11:05 AM To: Struts Users Mailing List Subject: RE: [OT] Sending email from struts Did you try using JavaMail API -Original Message- From: Matt Bathje [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 11, 2004 10:03 AM To: strutslist Subject: [OT] Sending email from struts Hi all. This is kind of off topic as it is not really struts related, but somebody here would probably have the answer. We have our application sending emails to users at some points and it is working fine. The problem is that we have the email message hardcoded into the Java, which we would like to avoid either by storing the message in application.properties or our database. This would be easy, except all of the messages contain user-specific information like their name or phone number or order id or something like that. Anybody have any ideas (or links to programs!) that can read in an email, replace the information it needs to from the db, and send that to the user. I could obviously write something myself to do it, but wouldn't want to reinvent the wheel. Turns out this is hard to search for too - email is not a search term that makes things easy. Thanks, Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Sending email from struts
Sounds like you could use the MessageFormat class. At 08:04 AM 2/11/2004, Samyukta Akunuru wrote: Did you try using JavaMail API -Original Message- From: Matt Bathje [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 11, 2004 10:03 AM To: strutslist Subject: [OT] Sending email from struts Hi all. This is kind of off topic as it is not really struts related, but somebody here would probably have the answer. We have our application sending emails to users at some points and it is working fine. The problem is that we have the email message hardcoded into the Java, which we would like to avoid either by storing the message in application.properties or our database. This would be easy, except all of the messages contain user-specific information like their name or phone number or order id or something like that. Anybody have any ideas (or links to programs!) that can read in an email, replace the information it needs to from the db, and send that to the user. I could obviously write something myself to do it, but wouldn't want to reinvent the wheel. Turns out this is hard to search for too - email is not a search term that makes things easy. Thanks, Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Sending email from struts
Hi Matt, The first thought that comes through my mind is this: consider your email as a burden plain text message (/stream). Then, look for a text parser or similars. Most surely, you will be able to find something related to XML / XSLT technologies. Hope this gives you some ideas. Regards, Freddy. -Mensaje original- De: Matt Bathje [mailto:[EMAIL PROTECTED] Enviado el: miƩrcoles, 11 de febrero de 2004 17:03 Para: strutslist Asunto: [OT] Sending email from struts Hi all. This is kind of off topic as it is not really struts related, but somebody here would probably have the answer. We have our application sending emails to users at some points and it is working fine. The problem is that we have the email message hardcoded into the Java, which we would like to avoid either by storing the message in application.properties or our database. This would be easy, except all of the messages contain user-specific information like their name or phone number or order id or something like that. Anybody have any ideas (or links to programs!) that can read in an email, replace the information it needs to from the db, and send that to the user. I could obviously write something myself to do it, but wouldn't want to reinvent the wheel. Turns out this is hard to search for too - email is not a search term that makes things easy. Thanks, Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Sending email from struts
For our project, what we're using is Velocity. I wrote up a simple velocity utility class that would take a velocity template, a hashmap of values, and return the formatted string, and then use that string for the mail body. Then you can keep your velocity files (.vm) in the classpath, and fetch them via the classloader. It works pretty good. I would imagine that you could take it a bit further and store the velocity text in the database instead. The other option is to use the mailer taglib on a jsp page, but I found that it was distruptive in terms of workflow if you want to do a forward to a page while sending a email, like a password reminder workflow, etc. -tim -Original Message- From: Samyukta Akunuru [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 11, 2004 11:05 AM To: Struts Users Mailing List Subject: RE: [OT] Sending email from struts Did you try using JavaMail API -Original Message- From: Matt Bathje [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 11, 2004 10:03 AM To: strutslist Subject: [OT] Sending email from struts Hi all. This is kind of off topic as it is not really struts related, but somebody here would probably have the answer. We have our application sending emails to users at some points and it is working fine. The problem is that we have the email message hardcoded into the Java, which we would like to avoid either by storing the message in application.properties or our database. This would be easy, except all of the messages contain user-specific information like their name or phone number or order id or something like that. Anybody have any ideas (or links to programs!) that can read in an email, replace the information it needs to from the db, and send that to the user. I could obviously write something myself to do it, but wouldn't want to reinvent the wheel. Turns out this is hard to search for too - email is not a search term that makes things easy. Thanks, Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Sending email from struts
Did you try using JavaMail API -Original Message- From: Matt Bathje [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 11, 2004 10:03 AM To: strutslist Subject: [OT] Sending email from struts Hi all. This is kind of off topic as it is not really struts related, but somebody here would probably have the answer. We have our application sending emails to users at some points and it is working fine. The problem is that we have the email message hardcoded into the Java, which we would like to avoid either by storing the message in application.properties or our database. This would be easy, except all of the messages contain user-specific information like their name or phone number or order id or something like that. Anybody have any ideas (or links to programs!) that can read in an email, replace the information it needs to from the db, and send that to the user. I could obviously write something myself to do it, but wouldn't want to reinvent the wheel. Turns out this is hard to search for too - email is not a search term that makes things easy. Thanks, Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Sending email from struts
Hi all. This is kind of off topic as it is not really struts related, but somebody here would probably have the answer. We have our application sending emails to users at some points and it is working fine. The problem is that we have the email message hardcoded into the Java, which we would like to avoid either by storing the message in application.properties or our database. This would be easy, except all of the messages contain user-specific information like their name or phone number or order id or something like that. Anybody have any ideas (or links to programs!) that can read in an email, replace the information it needs to from the db, and send that to the user. I could obviously write something myself to do it, but wouldn't want to reinvent the wheel. Turns out this is hard to search for too - email is not a search term that makes things easy. Thanks, Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]