@ -1,12 +1,36 @@
/ * *
* Copyright ( c ) 2000 - 2013 Liferay , Inc . All rights reserved . The contents of this file are subject to the terms of the
* Liferay Enterprise Subscription License ( "License" ) . You may not use this file except in compliance with the License .
* You can obtain a copy of the License by contacting Liferay , Inc . See the License for the specific language governing
* permissions and limitations under the License , including but not limited to distribution rights of the Software .
* Copyright ( c ) 2000 - 2013 Liferay , Inc . All rights reserved .
*
* The contents of this file are subject to the terms of the Liferay Enterprise Subscription License
* ( "License" ) . You may not use this file except in compliance with the License . You can obtain a
* copy of the License by contacting Liferay , Inc . See the License for the specific language
* governing permissions and limitations under the License , including but not limited to
* distribution rights of the Software .
*
*
*
* /
package it.tref.liferay.portos.mailmanager.service.impl ;
import com.liferay.mail.model.FileAttachment ;
import com.liferay.portal.kernel.exception.PortalException ;
import com.liferay.portal.kernel.exception.SystemException ;
import com.liferay.portal.kernel.log.Log ;
import com.liferay.portal.kernel.log.LogFactoryUtil ;
import com.liferay.portal.kernel.repository.model.Folder ;
import com.liferay.portal.kernel.util.FileUtil ;
import com.liferay.portal.kernel.util.OrderByComparator ;
import com.liferay.portal.kernel.util.StringPool ;
import com.liferay.portal.kernel.util.StringUtil ;
import com.liferay.portal.kernel.util.Validator ;
import com.liferay.portal.model.Company ;
import com.liferay.portal.model.Group ;
import com.liferay.portal.model.User ;
import com.liferay.portal.security.permission.ActionKeys ;
import com.liferay.portal.service.ServiceContext ;
import com.liferay.portlet.documentlibrary.model.DLFolderConstants ;
import it.tref.liferay.portos.mailmanager.EmailBccException ;
import it.tref.liferay.portos.mailmanager.EmailBulkAddressesException ;
import it.tref.liferay.portos.mailmanager.EmailCcException ;
@ -27,30 +51,18 @@ import java.util.Collections;
import java.util.Date ;
import java.util.List ;
import com.liferay.mail.model.FileAttachment ;
import com.liferay.portal.kernel.exception.PortalException ;
import com.liferay.portal.kernel.exception.SystemException ;
import com.liferay.portal.kernel.repository.model.Folder ;
import com.liferay.portal.kernel.util.FileUtil ;
import com.liferay.portal.kernel.util.OrderByComparator ;
import com.liferay.portal.kernel.util.StringPool ;
import com.liferay.portal.kernel.util.StringUtil ;
import com.liferay.portal.kernel.util.Validator ;
import com.liferay.portal.model.Company ;
import com.liferay.portal.model.Group ;
import com.liferay.portal.model.User ;
import com.liferay.portal.security.permission.ActionKeys ;
import com.liferay.portal.service.ServiceContext ;
import com.liferay.portlet.documentlibrary.model.DLFolderConstants ;
/ * *
* The implementation of the email local service .
*
* < p >
* All custom service methods should be put in this class . Whenever methods are added , rerun ServiceBuilder to copy
* their definitions into the { @link it . noovle . azimut . icf . mailmanager . service . EmailLocalService } interface .
* All custom service methods should be put in this class . Whenever methods are
* added , rerun ServiceBuilder to copy their definitions into the
* { @link it . noovle . azimut . icf . mailmanager . service . EmailLocalService } interface .
*
* < p >
* This is a local service . Methods of this service will not have security checks based on the propagated JAAS
* credentials because this service can only be accessed from within the same VM .
* This is a local service . Methods of this service will not have security
* checks based on the propagated JAAS credentials because this service can only
* be accessed from within the same VM .
* < / p >
*
* @author
@ -59,67 +71,70 @@ import com.liferay.portlet.documentlibrary.model.DLFolderConstants;
* /
public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
/ *
* NOTE FOR DEVELOPERS : Never reference this interface directly . Always use { @link
* it . noovle . azimut . icf . mailmanager . service . EmailLocalServiceUtil } to access the email local service .
* NOTE FOR DEVELOPERS :
*
* Never reference this interface directly . Always use { @link
* it . noovle . azimut . icf . mailmanager . service . EmailLocalServiceUtil } to access
* the email local service .
* /
@Override
public Email addEmail ( String className , long classPK , String from , String to [ ] , String cc [ ] , String bcc [ ] ,
String subject , String body , boolean htmlFormat , ServiceContext serviceContext ) throws Exception {
private final static Log _log = LogFactoryUtil . getLog ( EmailLocalServiceImpl . class ) ;
return addEmail ( className , classPK , from , to , cc , bcc , null , subject , body , htmlFormat , null , null , null , null ,
0 , false , null , null , Collections . < FileAttachment > emptyList ( ) , serviceContext ) ;
public Email addEmail ( String className , long classPK , String from , String to [ ] , String cc [ ] ,
String bcc [ ] , String subject , String body , boolean htmlFormat , ServiceContext serviceContext )
throws Exception {
return addEmail ( className , classPK , from , to , cc , bcc , null , subject , body , htmlFormat , null , null ,
null , null , 0 , false , null , null , Collections . < FileAttachment > emptyList ( ) , serviceContext ) ;
}
@Override
public Email addEmail ( String className , long classPK , String from , String to [ ] , String cc [ ] , String bcc [ ] ,
String subject , String body , boolean htmlFormat , List < FileAttachment > fileAttachments ,
ServiceContext serviceContext ) throws Exception {
return addEmail ( className , classPK , from , to , cc , bcc , null , subject , body , htmlFormat , null , null , null , null ,
0 , false , null , null , fileAttachments , false , null , serviceContext ) ;
public Email addEmail ( String className , long classPK , String from , String to [ ] , String cc [ ] ,
String bcc [ ] , String subject , String body , boolean htmlFormat ,
List < FileAttachment > fileAttachments , ServiceContext serviceContext ) throws Exception {
return addEmail ( className , classPK , from , to , cc , bcc , null , subject , body , htmlFormat , null , null ,
null , null , 0 , false , null , null , fileAttachments , false , null , serviceContext ) ;
}
@Override
public Email addEmail ( String className , long classPK , String from , String to [ ] , String cc [ ] , String bcc [ ] ,
String [ ] bulkAddresses , String subject , String body , boolean htmlFormat , String [ ] replyTo ,
String messageId , String inReplyTo , String smtpHost , int smtpPort , boolean smtpSecure , String smtpUsername ,
String smtpPassword , List < FileAttachment > fileAttachments , ServiceContext serviceContext ) throws Exception {
return addEmail ( className , classPK , from , to , cc , bcc , bulkAddresses , subject , body , htmlFormat , replyTo ,
messageId , inReplyTo , smtpHost , smtpPort , smtpSecure , smtpUsername , smtpPassword , fileAttachments ,
false , null , serviceContext ) ;
public Email addEmail ( String className , long classPK , String from , String to [ ] , String cc [ ] ,
String bcc [ ] , String [ ] bulkAddresses , String subject , String body , boolean htmlFormat ,
String [ ] replyTo , String messageId , String inReplyTo , String smtpHost , int smtpPort ,
boolean smtpSecure , String smtpUsername , String smtpPassword ,
List < FileAttachment > fileAttachments , ServiceContext serviceContext ) throws Exception {
return addEmail ( className , classPK , from , to , cc , bcc , bulkAddresses , subject , body , htmlFormat ,
replyTo , messageId , inReplyTo , smtpHost , smtpPort , smtpSecure , smtpUsername , smtpPassword ,
fileAttachments , false , null , serviceContext ) ;
}
@Override
public Email addEmail ( String className , long classPK , String from , String to [ ] , String cc [ ] , String bcc [ ] ,
String subject , String body , boolean htmlFormat , List < FileAttachment > fileAttachments , boolean sendSync ,
ServiceContext serviceContext ) throws Exception {
return addEmail ( className , classPK , from , to , cc , bcc , null , subject , body , htmlFormat , null , null , null , null ,
0 , false , null , null , fileAttachments , sendSync , null , serviceContext ) ;
public Email addEmail ( String className , long classPK , String from , String to [ ] , String cc [ ] ,
String bcc [ ] , String subject , String body , boolean htmlFormat ,
List < FileAttachment > fileAttachments , boolean sendSync , ServiceContext serviceContext )
throws Exception {
return addEmail ( className , classPK , from , to , cc , bcc , null , subject , body , htmlFormat , null , null ,
null , null , 0 , false , null , null , fileAttachments , sendSync , null , serviceContext ) ;
}
@Override
public Email addEmail ( String className , long classPK , String from , String to [ ] , String cc [ ] , String bcc [ ] ,
String subject , String body , boolean htmlFormat , List < FileAttachment > fileAttachments , boolean sendSync ,
String templateName , ServiceContext serviceContext ) throws Exception {
return addEmail ( className , classPK , from , to , cc , bcc , null , subject , body , htmlFormat , null , null , null , null ,
0 , false , null , null , fileAttachments , sendSync , templateName , serviceContext ) ;
public Email addEmail ( String className , long classPK , String from , String to [ ] , String cc [ ] ,
String bcc [ ] , String subject , String body , boolean htmlFormat ,
List < FileAttachment > fileAttachments , boolean sendSync , String templateName ,
ServiceContext serviceContext ) throws Exception {
return addEmail ( className , classPK , from , to , cc , bcc , null , subject , body , htmlFormat , null , null ,
null , null , 0 , false , null , null , fileAttachments , sendSync , templateName , serviceContext ) ;
}
@Override
public Email addEmail ( String className , long classPK , String from , String to [ ] , String cc [ ] , String bcc [ ] ,
String [ ] bulkAddresses , String subject , String body , boolean htmlFormat , String [ ] replyTo ,
String messageId , String inReplyTo , String smtpHost , int smtpPort , boolean smtpSecure , String smtpUsername ,
String smtpPassword , List < FileAttachment > fileAttachments , boolean sendSync , String templateName ,
public Email addEmail ( String className , long classPK , String from , String to [ ] , String cc [ ] ,
String bcc [ ] , String [ ] bulkAddresses , String subject , String body , boolean htmlFormat ,
String [ ] replyTo , String messageId , String inReplyTo , String smtpHost , int smtpPort ,
boolean smtpSecure , String smtpUsername , String smtpPassword ,
List < FileAttachment > fileAttachments , boolean sendSync , String templateName ,
ServiceContext serviceContext ) throws Exception {
User user = userLocalService . getUser ( serviceContext . getUserId ( ) ) ;
Date now = new Date ( ) ;
validate ( from , to , cc , bcc , bulkAddresses , subject , body , replyTo ) ;
Email email = createEmail ( counterLocalService . increment ( Email . class . getName ( ) ) ) ;
Email email = emailLocalService . createEmail ( counterLocalService . increment ( Email . class . getName ( ) ) ) ;
email . setGroupId ( serviceContext . getScopeGroupId ( ) ) ;
email . setCompanyId ( serviceContext . getCompanyId ( ) ) ;
email . setCreateDate ( serviceContext . getCreateDate ( now ) ) ;
@ -128,6 +143,7 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
email . setClassPK ( classPK ) ;
email . setUserId ( user . getUserId ( ) ) ;
email . setUserName ( user . getFullName ( ) ) ;
email . setFrom ( from ) ;
email . setTo ( StringUtil . merge ( to , StringPool . COMMA ) ) ;
email . setCc ( StringUtil . merge ( cc , StringPool . COMMA ) ) ;
@ -135,10 +151,12 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
email . setBulkAddresses ( StringUtil . merge ( bulkAddresses , StringPool . COMMA ) ) ;
email . setSubject ( subject ) ;
email . setBody ( body ) ;
email . setHtmlFormat ( htmlFormat ) ;
email . setReplyTo ( StringUtil . merge ( replyTo , StringPool . COMMA ) ) ;
email . setMessageId ( messageId ) ;
email . setInReplyTo ( inReplyTo ) ;
email . setSmtpHost ( smtpHost ) ;
email . setSmtpPort ( smtpPort ) ;
email . setSmtpSecure ( smtpSecure ) ;
@ -146,37 +164,46 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
email . setSmtpPassword ( smtpPassword ) ;
email . setCancel ( false ) ;
email . setTemplateName ( templateName ) ;
email = addEmail ( email ) ;
// Email Attachments
if ( fileAttachments ! = null & & ! fileAttachments . isEmpty ( ) ) {
Folder folder = addEmailAttachmentsFolder ( serviceContext . getCompanyId ( ) , email . getEmailId ( ) ) ;
for ( FileAttachment fileAttachment : fileAttachments ) {
if ( fileAttachment instanceof FileAttachment ) {
( ( it . tref . liferay . portos . mailmanager . shared . model . FileAttachment ) fileAttachment ) . generateFile ( ) ;
( ( it . tref . liferay . portos . mailmanager . shared . model . FileAttachment ) fileAttachment )
. generateFile ( ) ;
}
emailAttachmentLocalService . addEmailAttachment ( serviceContext . getCompanyId ( ) , email . getEmailId ( ) ,
folder . getFolderId ( ) , fileAttachment . getFileName ( ) , fileAttachment . getFile ( ) ) ;
emailAttachmentLocalService . addEmailAttachment ( serviceContext . getCompanyId ( ) ,
email . getEmailId ( ) , folder . getFolderId ( ) , fileAttachment . getFileName ( ) ,
fileAttachment . getFile ( ) ) ;
FileUtil . delete ( fileAttachment . getFile ( ) ) ;
}
}
// Manifattura Web Group per Regione Siciliana
// Il valore di ritorno viene ignorato da SchedulerInvioDocumenti, le mail impostate per l'invio asincrono si
// perdono nell'abisso dell'oblio. Siccome questo è già un task asincrono, inviamo in maniera sincrona e
// festeggiamo.
// Il valore di ritorno viene ignorato da SchedulerInvioDocumenti, le
// mail impostate per l'invio asincrono si perdono nell'abisso
// dell'oblio. Siccome questo è già un task asincrono, inviamo in
// maniera sincrona e festeggiamo.
sendSync = true ;
if ( sendSync ) {
MailSenderUtil . sendMail ( email ) ;
markAsSent ( email . getEmailId ( ) , new Date ( ) , StringPool . BLANK ) ;
}
return email ;
}
@Override
public Email updateEmail ( long emailId , String from , String to [ ] , String cc [ ] , String bcc [ ] , String subject ,
String body , ServiceContext serviceContext ) throws Exception {
public Email updateEmail ( long emailId , String from , String to [ ] , String cc [ ] , String bcc [ ] ,
String subject , String body , ServiceContext serviceContext ) throws Exception {
Email email = emailLocalService . getEmail ( emailId ) ;
Email email = getEmail ( emailId ) ;
validate ( from , to , cc , bcc , null , subject , body , null ) ;
email . setModifiedDate ( new Date ( ) ) ;
email . setFrom ( from ) ;
email . setTo ( StringUtil . merge ( to , StringPool . COMMA ) ) ;
@ -184,54 +211,60 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
email . setBcc ( StringUtil . merge ( bcc , StringPool . COMMA ) ) ;
email . setSubject ( subject ) ;
email . setBody ( body ) ;
return updateEmail ( email ) ;
}
@Override
public Email markAsSent ( long emailId , Date sentDate , String statusMessage ) throws PortalException , SystemException {
public Email markAsSent ( long emailId , Date sentDate , String statusMessage ) throws PortalException ,
SystemException {
Email email = getEmail ( emailId ) ;
Email email = emailLocalService . getEmail ( emailId ) ;
email . setModifiedDate ( new Date ( ) ) ;
email . setSent ( true ) ;
email . setSentDate ( sentDate ) ;
email . setStatusMessage ( statusMessage ) ;
return updateEmail ( email ) ;
}
@Override
public Email updateStatusMessage ( long emailId , String statusMessage ) throws PortalException , SystemException {
public Email updateStatusMessage ( long emailId , String statusMessage ) throws PortalException ,
SystemException {
Email email = getEmail ( emailId ) ;
Email email = emailLocalService . getEmail ( emailId ) ;
email . setModifiedDate ( new Date ( ) ) ;
email . setStatusMessage ( statusMessage ) ;
return updateEmail ( email ) ;
}
@Override
public Email resendEmail ( long emailId ) throws PortalException , SystemException {
Email email = getEmail ( emailId ) ;
Email email = emailLocalService . getEmail ( emailId ) ;
email . setModifiedDate ( new Date ( ) ) ;
email . setStatusMessage ( "" ) ;
email . setSent ( false ) ;
email . setSentDate ( null ) ;
email . setCancel ( false ) ;
return updateEmail ( email ) ;
}
@Override
public Email cancelEmail ( long emailId ) throws PortalException , SystemException {
Email email = getEmail ( emailId ) ;
Email email = emailLocalService . getEmail ( emailId ) ;
email . setModifiedDate ( new Date ( ) ) ;
email . setCancel ( true ) ;
return updateEmail ( email ) ;
}
@Override
public Email deleteEmail ( long emailId ) throws PortalException , SystemException {
Email email = getEmail ( emailId ) ;
Email email = emailLocalService . getEmail ( emailId ) ;
return deleteEmail ( email ) ;
}
@ -239,126 +272,108 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
public Email deleteEmail ( Email email ) throws SystemException {
super . deleteEmail ( email ) ;
// Email Attachments
List < EmailAttachment > emailAttachments = emailAttachmentLocalService . findByEmailId ( email . getEmailId ( ) ) ;
List < EmailAttachment > emailAttachments = emailAttachmentLocalService
. findByEmailId ( email . getEmailId ( ) ) ;
for ( EmailAttachment emailAttachment : emailAttachments ) {
emailAttachmentLocalService . deleteEmailAttachment ( emailAttachment ) ;
}
return email ;
}
@Override
public List < Email > findByCompany ( long companyId ) throws SystemException {
return emailPersistence . findByCompany ( companyId ) ;
}
@Override
public List < Email > findByCompany ( long companyId , int start , int end ) throws SystemException {
return emailPersistence . findByCompany ( companyId , start , end ) ;
}
@Override
public List < Email > findByCompany ( long companyId , int start , int end , OrderByComparator orderByComparator )
throws SystemException {
return emailPersistence . findByCompany ( companyId , start , end , orderByComparator ) ;
}
@Override
public int countByCompany ( long companyId ) throws SystemException {
return emailPersistence . countByCompany ( companyId ) ;
}
@Override
public List < Email > findByC_G ( long companyId , long groupId ) throws SystemException {
return emailPersistence . findByC_G ( companyId , groupId ) ;
}
@Override
public List < Email > findByC_G ( long companyId , long groupId , int start , int end ) throws SystemException {
return emailPersistence . findByC_G ( companyId , groupId , start , end ) ;
}
@Override
public List < Email > findByC_G ( long companyId , long groupId , int start , int end , OrderByComparator orderByComparator )
throws SystemException {
public List < Email > findByC_G ( long companyId , long groupId , int start , int end ,
OrderByComparator orderByComparator ) throws SystemException {
return emailPersistence . findByC_G ( companyId , groupId , start , end , orderByComparator ) ;
}
@Override
public int countByC_G ( long companyId , long groupId ) throws SystemException {
return emailPersistence . countByC_G ( companyId , groupId ) ;
}
@Override
public List < Email > findByC_G_T ( long companyId , long groupId , String templateName ) throws SystemException {
return emailPersistence . findByC_G_T ( companyId , groupId , templateName ) ;
}
@Override
public List < Email > findByC_G_T ( long companyId , long groupId , String templateName , int start , int end )
throws SystemException {
return emailPersistence . findByC_G_T ( companyId , groupId , templateName , start , end ) ;
}
@Override
public int countByC_G_T ( long companyId , long groupId , String templateName ) throws SystemException {
return emailPersistence . countByC_G_T ( companyId , groupId , templateName ) ;
}
@Override
public List < Email > findByC_G_C_C ( long companyId , long groupId , long classNameId , long classPK )
throws SystemException {
return emailPersistence . findByC_G_C_C ( companyId , groupId , classNameId , classPK ) ;
}
@Override
public List < Email > findByC_G_C_C ( long companyId , long groupId , long classNameId , long classPK , int start , int end )
throws SystemException {
public List < Email > findByC_G_C_C ( long companyId , long groupId , long classNameId , long classPK , int start ,
int end ) throws SystemException {
return emailPersistence . findByC_G_C_C ( companyId , groupId , classNameId , classPK , start , end ) ;
}
@Override
public int countByC_G_C_C ( long companyId , long groupId , long classNameId , long classPK ) throws SystemException {
public int countByC_G_C_C ( long companyId , long groupId , long classNameId , long classPK )
throws SystemException {
return emailPersistence . countByC_G_C_C ( companyId , groupId , classNameId , classPK ) ;
}
private Folder addEmailAttachmentsFolder ( long companyId , long emailId ) throws PortalException , SystemException {
private Folder addEmailAttachmentsFolder ( long companyId , long emailId ) throws PortalException ,
SystemException {
Company company = companyLocalService . getCompany ( companyId ) ;
Group companyGroup = company . getGroup ( ) ;
User defaultUser = company . getDefaultUser ( ) ;
Folder folder =
dlAppLocalService . getFolder ( companyGroup . getGroupId ( ) , DLFolderConstants . DEFAULT_PARENT_FOLDER_ID ,
EmailConstants . DEFAULT_ATTACHMENTS_FOLDER_NAME ) ;
Folder folder = dlAppLocalService . getFolder ( companyGroup . getGroupId ( ) ,
DLFolderConstants . DEFAULT_PARENT_FOLDER_ID , EmailConstants . DEFAULT_ATTACHMENTS_FOLDER_NAME ) ;
ServiceContext serviceContext = new ServiceContext ( ) ;
serviceContext . setGroupPermissions ( new String [ ] { ActionKeys . VIEW } ) ;
serviceContext . setGuestPermissions ( new String [ ] { ActionKeys . VIEW } ) ;
return dlAppLocalService . addFolder ( defaultUser . getUserId ( ) , folder . getRepositoryId ( ) , folder . getFolderId ( ) ,
String . valueOf ( emailId ) , StringPool . BLANK , serviceContext ) ;
return dlAppLocalService . addFolder ( defaultUser . getUserId ( ) , folder . getRepositoryId ( ) ,
folder . getFolderId ( ) , String . valueOf ( emailId ) , StringPool . BLANK , serviceContext ) ;
}
private void validate ( String from , String to [ ] , String cc [ ] , String bcc [ ] , String [ ] bulkAddresses , String subject ,
String body , String [ ] replyTo ) throws PortalException {
private void validate ( String from , String to [ ] , String cc [ ] , String bcc [ ] , String [ ] bulkAddresses ,
String subject , String body , String [ ] replyTo ) throws PortalException {
if ( Validator . isNull ( from ) ) {
throw new RequiredEmailFromException ( ) ;
} else if ( ! Validator . isEmailAddress ( from ) ) {
throw new EmailFromException ( ) ;
}
if ( to = = null | | ( to ! = null & & to . length = = 0 ) ) {
throw new RequiredEmailToException ( ) ;
} else {
@ -368,6 +383,7 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
}
}
}
if ( cc ! = null & & cc . length > 0 ) {
for ( String emailAddress : cc ) {
if ( ! Validator . isEmailAddress ( emailAddress ) ) {
@ -375,6 +391,7 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
}
}
}
if ( bcc ! = null & & bcc . length > 0 ) {
for ( String emailAddress : bcc ) {
if ( ! Validator . isEmailAddress ( emailAddress ) ) {
@ -382,6 +399,7 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
}
}
}
if ( bulkAddresses ! = null & & bulkAddresses . length > 0 ) {
for ( String emailAddress : bulkAddresses ) {
if ( ! Validator . isEmailAddress ( emailAddress ) ) {
@ -389,12 +407,15 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
}
}
}
if ( Validator . isNull ( subject ) ) {
throw new RequiredEmailSubjectException ( ) ;
}
if ( Validator . isNull ( body ) ) {
throw new RequiredEmailBodyException ( ) ;
}
if ( replyTo ! = null & & replyTo . length = = 0 ) {
for ( String emailAddress : replyTo ) {
if ( ! Validator . isEmailAddress ( emailAddress ) ) {