Use Velocity to generate email

On 2014-07-14 14:21, Carlos Munoz 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 {
> 
> The only drawback with that would be that we wouldn't be able to call it
> with an array, but maybe we never invoke it that way.

That's what we usually do, actually.


-- 
Sean Flanigan

Senior Software Engineer
Engineering - Internationalisation
Red Hat