Author: sgoeschl
Date: Sun Apr 5 20:41:06 2009
New Revision: 762155
URL: http://svn.apache.org/viewvc?rev=762155&view=rev
Log:
[EMAIL-75] Email.setFrom and Email.addTo are using Email.charset to properly
encode the name.
Modified:
commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java
commons/proper/email/trunk/xdocs/changes.xml
Modified: commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java
URL:
http://svn.apache.org/viewvc/commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java?rev=762155&r1=762154&r2=762155&view=diff
==============================================================================
--- commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java
(original)
+++ commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java Sun
Apr 5 20:41:06 2009
@@ -614,8 +614,10 @@
/**
* Set the FROM field of the email to use the specified address. The email
- * address will also be used as the personal name. The name will be encoded
- * using the Java platform's default charset (UTF-16) if it contains
+ * address will also be used as the personal name.
+ * The name will be encoded by the charset of {...@link
#setCharset(java.lang.String) setCharset()}.
+ * If it is not set, it will be encoded using
+ * the Java platform's default charset (UTF-16) if it contains
* non-ASCII characters; otherwise, it is used as is.
*
* @param email A String.
@@ -631,9 +633,11 @@
/**
* Set the FROM field of the email to use the specified address and the
- * specified personal name. The name will be encoded using the Java
- * platform's default charset (UTF-16) if it contains non-ASCII
- * characters; otherwise, it is used as is.
+ * specified personal name.
+ * The name will be encoded by the charset of {...@link
#setCharset(java.lang.String) setCharset()}.
+ * If it is not set, it will be encoded using
+ * the Java platform's default charset (UTF-16) if it contains
+ * non-ASCII characters; otherwise, it is used as is.
*
* @param email A String.
* @param name A String.
@@ -644,7 +648,7 @@
public Email setFrom(String email, String name)
throws EmailException
{
- return setFrom(email, name, null);
+ return setFrom(email, name, this.charset);
}
/**
@@ -667,8 +671,11 @@
/**
* Add a recipient TO to the email. The email
- * address will also be used as the personal name. The name will be encoded
- * using the Java platform's default charset (UTF-16) if it contains
+ * address will also be used as the personal name.
+ * The name will be encoded by the charset of
+ * {...@link #setCharset(java.lang.String) setCharset()}.
+ * If it is not set, it will be encoded using
+ * the Java platform's default charset (UTF-16) if it contains
* non-ASCII characters; otherwise, it is used as is.
*
* @param email A String.
@@ -684,9 +691,12 @@
/**
* Add a recipient TO to the email using the specified address and the
- * specified personal name. The name will be encoded using the Java
- * platform's default charset (UTF-16) if it contains non-ASCII
- * characters; otherwise, it is used as is.
+ * specified personal name.
+ * The name will be encoded by the charset of
+ * {...@link #setCharset(java.lang.String) setCharset()}.
+ * If it is not set, it will be encoded using
+ * the Java platform's default charset (UTF-16) if it contains
+ * non-ASCII characters; otherwise, it is used as is.
*
* @param email A String.
* @param name A String.
@@ -697,7 +707,7 @@
public Email addTo(String email, String name)
throws EmailException
{
- return addTo(email, name, null);
+ return addTo(email, name, this.charset);
}
/**
@@ -742,8 +752,10 @@
/**
* Add a recipient CC to the email. The email
- * address will also be used as the personal name. The name will be encoded
- * using the Java platform's default charset (UTF-16) if it contains
+ * address will also be used as the personal name.
+ * The name will be encoded by the charset of {...@link
#setCharset(java.lang.String) setCharset()}.
+ * If it is not set, it will be encoded using
+ * the Java platform's default charset (UTF-16) if it contains
* non-ASCII characters; otherwise, it is used as is.
*
* @param email A String.
@@ -759,9 +771,11 @@
/**
* Add a recipient CC to the email using the specified address and the
- * specified personal name. The name will be encoded using the Java
- * platform's default charset (UTF-16) if it contains non-ASCII
- * characters; otherwise, it is used as is.
+ * specified personal name.
+ * The name will be encoded by the charset of {...@link
#setCharset(java.lang.String) setCharset()}.
+ * If it is not set, it will be encoded using
+ * the Java platform's default charset (UTF-16) if it contains
+ * non-ASCII characters; otherwise, it is used as is.
*
* @param email A String.
* @param name A String.
@@ -772,7 +786,7 @@
public Email addCc(String email, String name)
throws EmailException
{
- return addCc(email, name, null);
+ return addCc(email, name, this.charset);
}
/**
@@ -817,8 +831,10 @@
/**
* Add a blind BCC recipient to the email. The email
- * address will also be used as the personal name. The name will be encoded
- * using the Java platform's default charset (UTF-16) if it contains
+ * address will also be used as the personal name.
+ * The name will be encoded by the charset of {...@link
#setCharset(java.lang.String) setCharset()}.
+ * If it is not set, it will be encoded using
+ * the Java platform's default charset (UTF-16) if it contains
* non-ASCII characters; otherwise, it is used as is.
*
* @param email A String.
@@ -834,9 +850,11 @@
/**
* Add a blind BCC recipient to the email using the specified address and
- * the specified personal name. The name will be encoded using the Java
- * platform's default charset (UTF-16) if it contains non-ASCII
- * characters; otherwise, it is used as is.
+ * the specified personal name.
+ * The name will be encoded by the charset of {...@link
#setCharset(java.lang.String) setCharset()}.
+ * If it is not set, it will be encoded using
+ * the Java platform's default charset (UTF-16) if it contains
+ * non-ASCII characters; otherwise, it is used as is.
*
* @param email A String.
* @param name A String.
@@ -847,7 +865,7 @@
public Email addBcc(String email, String name)
throws EmailException
{
- return addBcc(email, name, null);
+ return addBcc(email, name, this.charset);
}
/**
@@ -892,8 +910,10 @@
/**
* Add a reply to address to the email. The email
- * address will also be used as the personal name. The name will be encoded
- * using the Java platform's default charset (UTF-16) if it contains
+ * address will also be used as the personal name.
+ * The name will be encoded by the charset of {...@link
#setCharset(java.lang.String) setCharset()}.
+ * If it is not set, it will be encoded using
+ * the Java platform's default charset (UTF-16) if it contains
* non-ASCII characters; otherwise, it is used as is.
*
* @param email A String.
@@ -909,9 +929,11 @@
/**
* Add a reply to address to the email using the specified address and
- * the specified personal name. The name will be encoded using the Java
- * platform's default charset (UTF-16) if it contains non-ASCII
- * characters; otherwise, it is used as is.
+ * the specified personal name.
+ * The name will be encoded by the charset of {...@link
#setCharset(java.lang.String) setCharset()}.
+ * If it is not set, it will be encoded using
+ * the Java platform's default charset (UTF-16) if it contains
+ * non-ASCII characters; otherwise, it is used as is.
*
* @param email A String.
* @param name A String.
@@ -922,7 +944,7 @@
public Email addReplyTo(String email, String name)
throws EmailException
{
- return addReplyTo(email, name, null);
+ return addReplyTo(email, name, this.charset);
}
/**
Modified: commons/proper/email/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/commons/proper/email/trunk/xdocs/changes.xml?rev=762155&r1=762154&r2=762155&view=diff
==============================================================================
--- commons/proper/email/trunk/xdocs/changes.xml (original)
+++ commons/proper/email/trunk/xdocs/changes.xml Sun Apr 5 20:41:06 2009
@@ -24,9 +24,12 @@
<body>
<release version="1.2-SNAPSHOT" date="as in SVN">
+ <action dev="sgoeschl" type="add" issue="EMAIL-75" date="2009-04-05"
due-to="Yu Kobayashi">
+ Email.setFrom and Email.addTo are using Email.charset to properly
encode the name.
+ </action>
<action dev="sgoeschl" type="add" issue="EMAIL-79" date="2009-04-05"
due-to="Edvin Syse, Corey Scott">
- SimpleEmail#setMsg() with UTF-8 content honors correct charset in
header and
- does encode the content correctly now.
+ SimpleEmail#setMsg() with UTF-8 content honors correct charset in
header and
+ does encode the content correctly now.
</action>
<action dev="sgoeschl" type="add" issue="EMAIL-84" date="2009-02-22"
due-to="Claudio Miranda">
Created additional methods to support timeouts.