Example usage for org.apache.commons.mail HtmlEmail setSubject

List of usage examples for org.apache.commons.mail HtmlEmail setSubject

Introduction

In this page you can find the example usage for org.apache.commons.mail HtmlEmail setSubject.

Prototype

public Email setSubject(final String aSubject) 

Source Link

Document

Set the email subject.

Usage

From source file:velo.tools.EmailSender.java

public void addHtmlEmail(String fromAddress, Collection<String> recipient, String subject, String body)
        throws EmailException {
    HtmlEmail email = new HtmlEmail();
    email.setHostName(getHostName());//from w w w.java  2 s  .  co  m
    //email.addTo("jdoe@somewhere.org", "John Doe");
    //email.addTo(recipient,recipient);
    email.setFrom(fromAddress, fromAddress);
    email.setSubject(subject);
    email.setHtmlMsg(body);
    for (String currRec : recipient) {
        email.addTo(currRec);
    }

    email.setCharset("UTF-8");

    log.debug("Adding a new message with subject '" + subject + "', from: '" + fromAddress + "', to: '"
            + recipient + "' to the queue...");
    log.debug("Email server parameters - SMTP host: " + getHostName());
    emails.add(email);
}