Example usage for org.apache.commons.mail MultiPartEmail setBcc

List of usage examples for org.apache.commons.mail MultiPartEmail setBcc

Introduction

In this page you can find the example usage for org.apache.commons.mail MultiPartEmail setBcc.

Prototype

public Email setBcc(final Collection<InternetAddress> aCollection) throws EmailException 

Source Link

Document

Set a list of "BCC" addresses.

Usage

From source file:org.kantega.respiro.mail.ServerConfig.java

public MultiPartEmail newMail() {
    MultiPartEmail mail = new MultiPartEmail();

    mail.setHostName(host);/*from www .j a v  a 2s  . c o  m*/
    if (!ssl)
        mail.setSmtpPort(port);
    else
        mail.setSslSmtpPort(valueOf(port));
    if (username != null && password != null)
        mail.setAuthentication(username, password);

    try {
        if (!to.isEmpty())
            mail.setTo(to);
        if (!cc.isEmpty())
            mail.setCc(cc);
        if (!bcc.isEmpty())
            mail.setBcc(bcc);
        if (fromMail != null)
            mail.setFrom(fromMail);
    } catch (EmailException e) {
        throw new RuntimeException(e);
    }

    return mail;
}