|
From: Juergen H. <ju...@in...> - 2005-02-16 22:28:05
|
Thanks for the suggestion, David. Such a common interface for mail messages is a good idea. However, the setters in the interface shouldn't throw javax.mail.MessagingException, which is a checked JavaMail exception. Consequently, I've redesigned the setters to throw MailParseException, and implemented a MimeMailMessage adapter that translates the calls into MimeMessageHelper calls (properly converting exceptions). Message population code can now interact with either a SimpleMailMessage or a MimeMailMessage through the common MailMessage interface. Juergen -----Original Message----- From: spr...@li... [mailto:spr...@li...]On Behalf Of David Bowers Sent: Wednesday, February 16, 2005 4:12 PM To: spr...@li... Subject: Re: [Springframework-developer] common super-interface in mail functionality Thanks for the response. I think the best way to explain is to just send the interface I have in mind, so it is attached. This would be implemented by SimpleMailMessage and MimeMessageHelper. Both classes already have all these methods, so no further change would be needed. I have an application that sends e-mail, sometimes plain text, and sometimes html. I set up the template subject, sender, and text of the e-mail as a non-singleton spring bean, and then add my more specific recipient list in code. I would like to be able to access the SimpleMailMessage and the MimeMessageHelper through a common interface, especially for a method like setTo(String). I guess I could send both html and text through the MimeMessageHelper, but it seemed like a common interface wouldn't hurt anything. /David Bowers On Tue, 18 Jan 2005 20:02:13 +0100, Alef Arendsen <al...@jt...> wrote: > What do you intend to do? > > The MimeMessageHelper already supports setting text/plain and text/html > parts through the setText(String plainText, String htmlText) method and > setText(String text, boolean html) methods. > > Regards, > Alef > > > > -----Original Message----- > > From: spr...@li... > > [mailto:spr...@li...] > > On Behalf Of David Bowers > > Sent: Tuesday, January 18, 2005 6:30 PM > > To: spr...@li... > > Subject: [Springframework-developer] common super-interface > > in mail functionality > > > > I'm using the mail components to write a small framework > > (apology for the way overused word) that can send either text > > or html e-mails. To simplify this, it would be nice if there > > were a common super-interface for > > org.springframework.mail.SimpleMailMessage and > > org.springframework.mail.javamail.MimeMessageHelper. They > > both share getters and setters for properties like cc, to, > > from, text, etc. It would be nice to be able to have common > > initialization code regardless of whether I'm working with a > > text or html message. > > > > > > ------------------------------------------------------- > > The SF.Net email is sponsored by: Beat the post-holiday blues > > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > > _______________________________________________ > > Springframework-developer mailing list > > Spr...@li... > > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > > > > > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > |