[seam-dev] RES: Is this the mail API you always wanted?
José Rodolfo Carrijo de Freitas
jose.freitas at softplan.com.br
Mon Feb 7 14:56:12 EST 2011
It Looks really nice!
If I may suggest something, maybe we can add the possibility to use just
.send() ( keeping the send(session) method ).
If theres no specific session argument, the module could handle the
injection within itself.
Best regards,
José Rodolfo Carrijo de Freitas
Analista de Sistemas
Softplan - Departamento de pesquisa e desenvolvimento
Sistema da Qualidade Certificado ISO 9001:2008
(48) 3027 8000 Ramal 8359
<http://www.softplan.com.br> http://www.softplan.com.br
De: seam-dev-bounces at lists.jboss.org
[mailto:seam-dev-bounces at lists.jboss.org] Em nome de Lincoln Baxter, III
Enviada em: segunda-feira, 7 de fevereiro de 2011 17:33
Para: Dan Allen
Cc: Seam Mailing List
Assunto: Re: [seam-dev] Is this the mail API you always wanted?
Cody,
This look EXCELLENT.
I have one question/potential suggestion so far regarding:
.subjectHTMLFromClassPath("subject.html.vm")
.templateHTMLFromClassPath("template.html.vm")
and related methods.
Have you considered creating an abstraction here that alows for pluggable
template resolvers? Otherwise you have this "explosion" of methods in the
interface that may end up causing maintenance woes. However, if you replaced
this with something like:
.template(new HtmlFromClassPath("template.html.vm"))
.subject(new HtmlFromClassPath("subject.html.vm"))
People would be empowered to implement a simple interface with limitless
extension possibilities.
Thoughts?
~Lincoln
On Mon, Feb 7, 2011 at 1:57 PM, Dan Allen <dan.j.allen at gmail.com> wrote:
Seam devs,
Cody is looking for some feedback on the mail module [1] before he drafts a
reference guide and puts the API on ice.
Seam mail is important because, let's face it, the Java Mail API needs a
makeover. Thankfully, the CDI programming model offers the necessary hooks
to create a modernized mail API capable of deep integration with the Java EE
platform (specifically the Java Mail API and container-managed sessions).
Seam Mail offers a fluent API that makes sending e-mail in Java a painless
experience. But an e-mail is nothing without the content. That's why Seam
Mail offers several templating options, such as Velocity, as well as an
extensible template SPI, to allow you to select your templating solution of
choice. With Seam Mail, you'll be sending e-mail from your application in no
time.
Is this how you imagined it would be?
Basic:
@Inject
private Instance<MailMessage> mailMessage;
@Inject
private Session session;
mailMessage.get()
.from("Seam Framework", "seam at jboss.org")
.to("John Smith", "john.smith at acme.com")
.subject("Text Message from Seam Mail - " +
java.util.UUID.randomUUID().toString())
.textBody(text)
.send(session);
Velocity:
@Inject
private Instance<VelocityMailMessage> velocityMailMessage;
@Inject
private Session session;
velocityMailMessage.get().from("Seam Framework", "seam at jboss.org")
.to(person.getName(), person.getEmail())
.subject("HTML Message from Seam Mail - " +
java.util.UUID.randomUUID().toString())
.templateHTMLFromClassPath("template.html.vm")
.put("version", "Seam 3")
.importance(MessagePriority.HIGH)
.addAttachment(new
URL("http://www.seamframework.org/themes/sfwkorg/img/seam_icon_large.png"),
"seamLogo.png", ContentDisposition.INLINE);
.send(session);
We look forward to your feedback.
-Dan
[1] http://github.com/seam/mail
http://seamframework.org/Seam3/Mail
--
Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597
http://www.google.com/profiles/dan.j.allen#about
http://mojavelinux.com
http://mojavelinux.com/seaminaction
_______________________________________________
seam-dev mailing list
seam-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/seam-dev
--
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/seam-dev/attachments/20110207/9d09b4c0/attachment-0001.html
More information about the seam-dev
mailing list