List of usage examples for org.apache.commons.mail SimpleEmail addBcc
public Email addBcc(final String email) throws EmailException
From source file:ke.co.tawi.babblesms.server.utils.net.EmailUtil.java
/** * @see java.lang.Thread#run()// ww w. ja va 2 s. co m */ @Override public void run() { SimpleEmail email; try { email = new SimpleEmail(); email.setHostName(outgoingEmailServer); email.setSmtpPort(outgoingEmailPort); //email.setAuthenticator(new DefaultAuthenticator(outgoingUsername, outgoingPassword)); //email.setSSLOnConnect(true); email.setFrom(from); email.addTo(to); if (cc.length > 0) { email.addCc(cc); } if (bcc.length > 0) { email.addBcc(bcc); } email.setSubject(subject); email.setMsg(body); if (validateEmails(to)) { email.send(); } else { logger.error("Invalid destinations in " + toString()); } } catch (EmailException e) { logger.error("EmailException when trying to send out a SimpleEmail: " + this.toString()); logger.error(ExceptionUtils.getStackTrace(e)); } }
From source file:org.sigmah.server.mail.InvitationMailer.java
@Override @Trace//from www . ja va 2 s . com @LogException public void send(Invitation model, Locale locale) throws EmailException, TemplateException, IOException { ResourceBundle mailMessages = getResourceBundle(locale); SimpleEmail mail = new SimpleEmail(); mail.addTo(model.getNewUser().getEmail(), model.getNewUser().getName()); mail.addBcc("akbertram@gmail.com"); // for testing purposes mail.setSubject(mailMessages.getString("newUserSubject")); mail.setMsg(composeMessage(model, locale)); sender.send(mail); }