public void execute() throws MojoExecutionException { // Run only at the execution root if (runOnlyAtExecutionRoot && !isThisTheExecutionRoot()) { getLog() .info( "Skipping the announcement mail in this project because it's not the Execution Root"); } else { File templateFile = new File(templateOutputDirectory, template); ConsoleLogger logger = new ConsoleLogger(Logger.LEVEL_INFO, "base"); if (getLog().isDebugEnabled()) { logger.setThreshold(Logger.LEVEL_DEBUG); } mailer.enableLogging(logger); mailer.setSmtpHost(getSmtpHost()); mailer.setSmtpPort(getSmtpPort()); mailer.setSslMode(sslMode); if (username != null) { mailer.setUsername(username); } if (password != null) { mailer.setPassword(password); } mailer.initialize(); if (getLog().isDebugEnabled()) { getLog().debug("fromDeveloperId: " + getFromDeveloperId()); } if (templateFile.isFile()) { getLog().info("Connecting to Host: " + getSmtpHost() + ":" + getSmtpPort()); sendMessage(); } else { throw new MojoExecutionException("Announcement template " + templateFile + " not found..."); } } }