List:
Sorry for the multiple emails, the attach didn't work. My mistake.
Attached is a patchfile (let's hope it works, this was my first) of adjustments
made to the commons-mail Email.java class file. Any questions/comments please
email back.
Thanks
Travis Meisenheimer
Index: Email.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/email/src/java/org/apache/commons/mail/Email.java,v
retrieving revision 1.3
diff -u -r1.3 Email.java
--- Email.java 3 Dec 2004 17:10:37 -0000 1.3
+++ Email.java 30 Dec 2004 03:05:25 -0000
@@ -13,8 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.mail;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
@@ -498,6 +500,39 @@
}
/**
+ * Set a list of "TO" addresses using String []
+ *
+ * @param to a String [] of addressess {"[EMAIL PROTECTED]", "[EMAIL PROTECTED]"}
+ * @return An Email.
+ * @throws AddressException Indicates an invalid email address
+ *
+ */
+
+ public Email setTo(String [] to) throws EmailException {
+ for (int i = 0; i < to.length; i++)
+ this.toList.add( createInternetAddress( to[i], null ) );
+
+ return this;
+ }
+
+ /**
+ * Set a list of "TO" addresses using String [][]
+ *
+ * @param to a String [][] of addressess {{"[EMAIL PROTECTED]", "Joe Blow"}, { "[EMAIL PROTECTED]", "Dick Blow"}}
+ * @return An Email.
+ * @throws AddressException Indicates an invalid email address
+ *
+ */
+
+ public Email setTo(String [][] to) throws EmailException {
+ for (int i = 0; i < to.length; i++)
+ this.toList.add( createInternetAddress( to[i][0], to[i][1] ) );
+
+ return this;
+ }
+
+
+ /**
* Add a recipient CC to the email.
*
* @param email A String.
@@ -545,6 +580,41 @@
return this;
}
+
+
+ /**
+ * Set a list of "CC" addresses using String []
+ *
+ * @param cc a String [] of addressess {"[EMAIL PROTECTED]", "[EMAIL PROTECTED]"}
+ * @return An Email.
+ * @throws AddressException Indicates an invalid email address
+ *
+ */
+
+ public Email setCc(String [] cc) throws EmailException {
+ for (int i = 0; i < cc.length; i++)
+ this.ccList.add( createInternetAddress( cc[i], null ) );
+
+ return this;
+ }
+
+ /**
+ * Set a list of "CC" addresses using String [][]
+ *
+ * @param cc a String [][] of addressess {{"[EMAIL PROTECTED]", "Joe Blow"}, { "[EMAIL PROTECTED]", "Dick Blow"}}
+ * @return An Email.
+ * @throws AddressException Indicates an invalid email address
+ *
+ */
+
+ public Email setCc(String [][] cc) throws EmailException {
+ for (int i = 0; i < cc.length; i++)
+ this.ccList.add( createInternetAddress( cc[i][0], cc[i][1] ) );
+
+ return this;
+ }
+
+
/**
* Add a blind BCC recipient to the email.
*
@@ -590,6 +660,39 @@
}
this.bccList = new ArrayList(aCollection);
+ return this;
+ }
+
+
+ /**
+ * Set a list of "BCC" addresses using String []
+ *
+ * @param bcc a String [] of addressess {"[EMAIL PROTECTED]", "[EMAIL PROTECTED]"}
+ * @return An Email.
+ * @throws AddressException Indicates an invalid email address
+ *
+ */
+
+ public Email setBcc(String [] bcc) throws EmailException {
+ for (int i = 0; i < bcc.length; i++)
+ this.bccList.add( createInternetAddress( bcc[i], null ) );
+
+ return this;
+ }
+
+ /**
+ * Set a list of "BCC" addresses using String [][]
+ *
+ * @param bcc a String [][] of addressess {{"[EMAIL PROTECTED]", "Joe Blow"}, { "[EMAIL PROTECTED]", "Dick Blow"}}
+ * @return An Email.
+ * @throws AddressException Indicates an invalid email address
+ *
+ */
+
+ public Email setBcc(String [][] bcc) throws EmailException {
+ for (int i = 0; i < bcc.length; i++)
+ this.bccList.add( createInternetAddress( bcc[i][0], bcc[i][1] ) );
+
return this;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]