List of usage examples for org.apache.commons.mail Email setTo
public Email setTo(final Collection<InternetAddress> aCollection) throws EmailException
From source file:org.xerela.server.birt.ReportJob.java
private void setupEmail(JobExecutionContext executionContext, String emailTo, String emailCc, Email email) throws AddressException, EmailException { InternetAddress[] toAddrs = InternetAddress.parse(emailTo); email.setTo(Arrays.asList(toAddrs)); if (emailCc != null && emailCc.trim().length() > 0) { InternetAddress[] ccAddrs = InternetAddress.parse(emailCc); email.setCc(Arrays.asList(ccAddrs)); }//from w w w . j ava 2s.c o m email.setCharset("utf-8"); //$NON-NLS-1$ email.setHostName(System.getProperty(MAIL_HOST_PROP, "mail")); //$NON-NLS-1$ String authUser = System.getProperty(MAIL_AUTH_USER_PROP); if (authUser != null) { email.setAuthentication(authUser, System.getProperty(MAIL_AUTH_PASSWORD_PROP)); } email.setFrom(System.getProperty(MAIL_FROM_PROP), System.getProperty(MAIL_FROM_NAME_PROP)); email.setSubject( Messages.bind(Messages.ReportJob_emailSubject, executionContext.getJobDetail().getFullName())); email.addHeader("X-Mailer", "Xerela Mailer"); //$NON-NLS-1$ //$NON-NLS-2$ email.setDebug(Boolean.getBoolean("org.xerela.mail.debug")); //$NON-NLS-1$ }