throw new MojoExecutionException( "Invalid mail sender: name and email is mandatory (" + ms + ")." );
}
getLog().info( "Using this sender for email announcement: " + fromAddress + " < " + fromName + " > " );
try
{
MailMessage mailMsg = new MailMessage();
mailMsg.setSubject( getSubject() );
mailMsg.setContent( IOUtil.toString( readAnnouncement( templateFile ) ) );
mailMsg.setContentType( this.mailContentType );
mailMsg.setFrom( fromAddress, fromName );
final Iterator it = getToAddresses().iterator();
while ( it.hasNext() )
{
email = it.next().toString();
getLog().info( "Sending mail to " + email + "..." );
mailMsg.addTo( email, "" );
}
if ( getCcAddresses() != null )
{
final Iterator it2 = getCcAddresses().iterator();
while ( it2.hasNext() )
{
email = it2.next().toString();
getLog().info( "Sending cc mail to " + email + "..." );
mailMsg.addCc( email, "" );
}
}
if ( getBccAddresses() != null )
{
final Iterator it3 = getBccAddresses().iterator();
while ( it3.hasNext() )
{
email = it3.next().toString();
getLog().info( "Sending bcc mail to " + email + "..." );
mailMsg.addBcc( email, "" );
}
}
mailer.send( mailMsg );
getLog().info( "Sent..." );