import com.google.common.annotations.VisibleForTesting;
import com.sun.mail.smtp.SMTPTransport;
+import org.apache.log4j.Logger;
/**
* {@link Action} implementation that sends an email containing the triggering
*/
public class EmailAction implements Action {
+ private static final Logger logger = Logger.getLogger(EmailAction.class);
+
/** The email address of the sender. */
private final String sender;
addHtmlPart(output, multipart);
message.setContent(multipart);
- transport.connect();
+ if (!transport.isConnected()) {
+ transport.connect();
+ }
transport.sendMessage(message, message.getAllRecipients());
} catch (MessagingException me1) {
- /* swallow. */
+ logger.error("Could not send email!", me1);
}
}