<div class="gmail_quote">On Sun, Feb 27, 2011 at 18:22, Cody Lerum <span dir="ltr"><<a href="mailto:cody.lerum@gmail.com">cody.lerum@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
1. From Lincoln<br>
<br>
Utilizing an Interface for handling the different ways one could<br>
create an email template. -<br>
<a href="https://issues.jboss.org/browse/SEAMMAIL-19" target="_blank">https://issues.jboss.org/browse/SEAMMAIL-19</a><br>
<br>
This is Done.<br>
<br>
VelocityMailMessage vmm = velocityMailMessage.get();<br>
<br>
vmm.from("seam@test.test", "Seam Framework")<br>
.to(person)<br>
.subject("HTML Message from Seam Mail - " +<br>
java.util.UUID.randomUUID().toString())<br>
.bodyHtml(new VelocityClassPathTemplate("template.html.vm"))<br>
.put("version", "Seam 3")<br>
.importance(MessagePriority.HIGH)<br>
vmm.send(session.get());<br></blockquote><div><br></div><div>Excellent.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
the contact fields also support a interface as well so one only<br>
need implement a getName and getAddress method on their User entity<br>
(for example) in order to pass it directly into an email -<br>
<a href="https://github.com/seam/mail/blob/6f70057cca7da712576c21f44bda80082ae1f0a1/examples/sendmail/src/main/java/org/jboss/seam/mail/example/Person.java" target="_blank">https://github.com/seam/mail/blob/6f70057cca7da712576c21f44bda80082ae1f0a1/examples/sendmail/src/main/java/org/jboss/seam/mail/example/Person.java</a></blockquote>
<div><br></div><div>Good thinking! I like it.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
5. From Dan via ALR reguarding ordering of the name and address in<br>
contact methods<br>
<br>
I've reordered everything to aways takes Address first and then Name if any.<br>
<br>
to("<a href="mailto:cody@test.com">cody@test.com</a>")<br>
to("<a href="mailto:cody@test.com">cody@test.com</a>", "Cody")<br>
<br>
<br>
Thats what I have for now. The one question I have is do we just drop<br>
the ability to do<br>
<br>
to("<a href="mailto:cody@test.com">cody@test.com</a>", "Cody")<br>
<br>
and require<br>
<br>
to(new BaseEmailContact("<a href="mailto:cody@test.com">cody@test.com</a>", "Cody")<br>
<br>
this would allow a var args address only to/from/cc/bcc/replyTo<br>
<br>
Thus you could do:<br>
<br>
to("<a href="mailto:cody@test.com">cody@test.com</a>")<br>
to("<a href="mailto:cody@test.com">cody@test.com</a>", "<a href="mailto:dan@test.com">dan@test.com</a>")<br>
<br>
but anything with the acutal name would need to be done with<br>
<br>
to(new BaseEmailContact("<a href="mailto:cody@test.com">cody@test.com</a>", "Cody")<br></blockquote><div><br></div><div>What about assuming that if there are exactly two arguments, and the second argument is not an e-mail address, then you assume it's the name part for the preceding. I know that's there's a hint of guesswork in there, but it nicely caters to the prototype use case and likely will be appreciate to "just work".</div>
<div><br></div><div>Example:</div><div><br></div><div>to("<a href="mailto:john.smith@acme.com">john.smith@acme.com</a>", "<a href="mailto:joe.cool@peanuts.org">joe.cool@peanuts.org</a>", "<a href="mailto:john.doe@example.org">john.doe@example.org</a>") -> 3 recipients</div>
<div><meta http-equiv="content-type" content="text/html; charset=utf-8">to("<a href="mailto:john.smith@acme.com">john.smith@acme.com</a>", "<a href="mailto:joe.cool@peanuts.org">joe.cool@peanuts.org</a>") -> 2 recipients</div>
<div><meta http-equiv="content-type" content="text/html; charset=utf-8">to("<a href="mailto:john.smith@acme.com">john.smith@acme.com</a>", "John Smith") -> 1 recipients</div><div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>
You can use a regular expression to check for an e-mail address in the second argument position, so long as you make it a configurable setting.</div></div><div><br></div><div>Keep in mind you can already do (if I'm not mistaken):</div>
<div><br></div><div>to("John Smith <<a href="mailto:john.smith@acme.com">john.smith@acme.com</a>>", "Joe Cool <<a href="mailto:joe.cool@peanuts.org">joe.cool@peanuts.org</a>>")</div><div><br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Of course if people are using existing objects it would be easier to<br>
just implement the EmailContact interface<br>
<br>
User user = new User("Cody", "<a href="mailto:cody@test.com">cody@test.com</a>", RoleType.ADMIN);<br></blockquote><div><br></div><div>But you are right, there are plenty of other options. I think it's safe to treat the two argument invocation as a special case.</div>
<div><br></div><div>-Dan</div><div><br></div></div>-- <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>