Use Velocity to generate email

We just need something that doesn't make it too easy to leave out the
addresses by accident.  I'm not greatly worried about the possibility that
someone will deliberately pass a zero-length array.

It's already fairly explicit in the signature.



On Mon, Jul 14, 2014 at 3:40 PM, David Mason <notifications@github.com>
wrote:

> In zanata-war/src/main/java/org/zanata/email/EmailBuilder.java:
>
> > +                ClasspathResourceLoader.class.getName());
> > +        // this allows unit tests to detect missing context vars:
> > +        ve.setProperty("runtime.references.strict", true);
> > +        ve.init();
> > +        return ve;
> > +    }
> > +
> > +    /**
> > +     * Build message using 'strategy' and send it via Transport to 'toAddress'.
> > +     * @param strategy
> > +     * @throws javax.mail.MessagingException
> > +     * @throws java.io.UnsupportedEncodingException
> > +     */
> > +    public void sendMessage(EmailBuilderStrategy strategy,
> > +            InternetAddress toAddress, String receivedReason)
> > +            throws MessagingException, UnsupportedEncodingException {
>
>  Then I would have to copy toAddress and additionalAddresses to another
> collection/array, eg actualAddresses. I don't think it would be worth it.
>
> It seems like a small cost, for the benefit of having the compiler tell us
> the moment we break the requirement for having at least one address. By
> making the requirement explicit in the signature, there is less room for
> human error.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/zanata/zanata-server/pull/534/files#r14865102>.
>