diff --git a/announcement/src/main/org/apache/maven/announcement/MailUtils.java b/announcement/src/main/org/apache/maven/announcement/MailUtils.java index b314e488..d6f04c99 100644 --- a/announcement/src/main/org/apache/maven/announcement/MailUtils.java +++ b/announcement/src/main/org/apache/maven/announcement/MailUtils.java @@ -1,15 +1,7 @@ package org.apache.maven.announcement; -import java.io.PrintWriter; -import java.io.Writer; -import java.util.StringTokenizer; - -import org.apache.commons.net.smtp.SMTPClient; -import org.apache.commons.net.smtp.SMTPReply; -import org.apache.commons.net.smtp.SimpleSMTPHeader; - /* ==================================================================== - * Copyright 2004 The Apache Software Foundation. + * Copyright 2004-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,17 +17,35 @@ import org.apache.commons.net.smtp.SimpleSMTPHeader; * ==================================================================== */ +import java.io.PrintWriter; +import java.io.Writer; +import java.util.StringTokenizer; + +import org.apache.commons.net.smtp.SMTPClient; +import org.apache.commons.net.smtp.SMTPReply; +import org.apache.commons.net.smtp.SimpleSMTPHeader; + /** * Send an email message using Jakarta Commons Net - * * @author Felipe Leme - * * @version $Id$ */ public class MailUtils { + /** E-mail address separator. */ private static final String ADDRESS_SEPARATOR = ","; + /** + * Send an email message. + * + * @param server The server + * @param client The client + * @param from from e-mail address + * @param to to e-mail address + * @param subject e-mail subject + * @param msg e-mail body + * @return "ok" if everything is fine, the Exception error message otherwise + */ public static String sendMail(String server, String client, String from, String to, String subject, String msg) { @@ -90,7 +100,7 @@ public class MailUtils smtpClient.addRecipient(st.nextToken().trim()); } - System.out.println("Sending message from [" + from + "] to [" + System.out.println("Sending message from [" + from + "] to [" + to + "]"); // Use the SimpleSMTPHeader class to build the header @@ -126,7 +136,7 @@ public class MailUtils // everything is fine return "ok"; - } + } catch (Exception e) { e.printStackTrace(); @@ -134,4 +144,4 @@ public class MailUtils } } -} \ No newline at end of file +}