List of usage examples for org.apache.commons.mail HtmlEmail addTo
public Email addTo(final String email) throws EmailException
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 ww . ja v a2s . c om //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); }