<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Random comments:</div> - Is the from() method overloaded with a one arg version? We don't always have a decent name to associate an email with.<div> - does it make sense to support varargs for to(): to("<a href="mailto:emmanuel@nothingtosee.org">emmanuel@nothingtosee.org</a>", "<a href="mailto:dan@test.com">dan@test.com</a>")</div><div> - Make sure this API can also easily be used by people working in batches: ie pass a collection of to(Collection<String>) emails ie .bcc((setOfEmails);</div><div> - can the builder API be made contextual: ie if I start with a template() then bodyText() is not available (probably not going to be easy) </div><div> - is there an overloaded method send() with no arg (does that make sense?)<div> - does it make sense to have a typesafe template parameter injection</div><div><br></div><div>message</div><div> .template(ThankYouTemplate.class)</div><div> .date( new Date() )</div><div> .amount( amountInEur )</div><div> .send()</div><div><br></div><div>Where ThankYouTemplate is something like</div><div><br></div><div>@Template(file="my.template.vm", type=HTML)</div><div>interface ThankYouTemplate extends EmailTemplate< ThankYouTemplate> {</div><div> ThankYouTemplate date(Date date);</div><div> ThankYouTemplate amount(BigDecimal amount); </div><div>}</div><div> </div><div>This idea is an important departure from what has been done but might be worth prototyping. We have done stuffs vaguely similar in Hibernate Validator for the programmatic configuration API (constraints expose their parameters in a type-safe way.</div><div><a href="http://docs.jboss.org/hibernate/validator/4.2/reference/en-US/html_single/#programmaticapi">http://docs.jboss.org/hibernate/validator/4.2/reference/en-US/html_single/#programmaticapi</a></div><div><br></div><div>Emmanuel</div><div><div><br></div><div><br><div><div>On 7 févr. 2011, at 19:57, Dan Allen wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Seam devs,<div><br></div><div>Cody is looking for some feedback on the mail module [1] before he drafts a reference guide and puts the API on ice.</div><div><br></div><div>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).</div>
<div><br></div><div>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.</div>
<div><br></div><div>Is this how you imagined it would be?</div><div><br></div><div>Basic:<br></div><div><br></div><div><div> @Inject</div><div> private Instance<MailMessage> mailMessage;</div></div><div><br></div>
<div><div> @Inject</div><div> private Session session;</div></div><div><br></div><div><div> mailMessage.get()</div><div> .from("Seam Framework", "<a href="mailto:seam@jboss.org">seam@jboss.org</a>")</div>
<div> .to("John Smith", "<a href="mailto:john.smith@acme.com">john.smith@acme.com</a>")</div><div> .subject("Text Message from Seam Mail - " + java.util.UUID.randomUUID().toString())</div>
<div> .textBody(text)</div><div> .send(session);</div></div><div><br></div><div>Velocity:</div><div><br></div><div><div> @Inject</div><div> private Instance<VelocityMailMessage> velocityMailMessage;</div>
</div><div><br></div><div><div> @Inject</div><div> private Session session;</div></div><div><br></div><div><div> velocityMailMessage.get().from("Seam Framework", "<a href="mailto:seam@jboss.org">seam@jboss.org</a>")</div>
<div> .to(person.getName(), person.getEmail())</div><div> .subject("HTML Message from Seam Mail - " + java.util.UUID.randomUUID().toString())</div><div> .templateHTMLFromClassPath("template.html.vm")</div>
<div> .put("version", "Seam 3")</div><div> .importance(MessagePriority.HIGH)</div><div> .addAttachment(new URL("<a href="http://www.seamframework.org/themes/sfwkorg/img/seam_icon_large.png">http://www.seamframework.org/themes/sfwkorg/img/seam_icon_large.png</a>"), "seamLogo.png", ContentDisposition.INLINE);</div>
<div> .send(session);</div></div><div><br></div><div>We look forward to your feedback.</div><div><br></div><div>-Dan</div><div><br></div><div>[1] <a href="http://github.com/seam/mail">http://github.com/seam/mail</a></div>
<div><a href="http://seamframework.org/Seam3/Mail">http://seamframework.org/Seam3/Mail</a><br clear="all"><br>-- <br><div>Dan Allen</div>Principal Software Engineer, Red Hat | Author of Seam in Action<br>Registered Linux User #231597<br>
<br><div><a href="http://www.google.com/profiles/dan.j.allen#about" target="_blank">http://www.google.com/profiles/dan.j.allen#about</a><br><a href="http://mojavelinux.com/" target="_blank">http://mojavelinux.com</a><br><a href="http://mojavelinux.com/seaminaction" target="_blank">http://mojavelinux.com/seaminaction</a><br>
</div><br>
</div>
_______________________________________________<br>seam-dev mailing list<br><a href="mailto:seam-dev@lists.jboss.org">seam-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/seam-dev<br></blockquote></div><br></div></div></div></body></html>