You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ed...@apache.org on 2006/04/12 17:07:52 UTC
svn commit: r393480 -
/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/net/SMTP.java
Author: edith
Date: Wed Apr 12 08:07:49 2006
New Revision: 393480
URL: http://svn.apache.org/viewcvs?rev=393480&view=rev
Log:
It is now possible to set the name of the user in 'from' and 'Reply-to'. The name is taken from the parameters 'from', which should be in the form 'Name <na...@foo.org>'
Modified:
lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/net/SMTP.java
Modified: lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/net/SMTP.java
URL: http://svn.apache.org/viewcvs/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/net/SMTP.java?rev=393480&r1=393479&r2=393480&view=diff
==============================================================================
--- lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/net/SMTP.java (original)
+++ lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/net/SMTP.java Wed Apr 12 08:07:49 2006
@@ -58,6 +58,7 @@
String subject = null;
String data = null;
String charset ="ISO-8859-1";
+ BCodec encoder = null;
/**
*
@@ -103,6 +104,7 @@
socket = new Socket(host, port);
out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), charset)), true);
in = new DataInputStream(socket.getInputStream());
+ encoder = new BCodec(charset);
errlog = errlog + getResponse(220);
@@ -134,12 +136,15 @@
out.println("DATA");
errlog = errlog + getResponse(354);
- errlog = errlog + "From: " + from + "\n";
- out.println("From: " + from);
+ String base64reply_to = encoder.encode(reply_to);
+ errlog = errlog + "From: " + base64reply_to + "\n";
+ out.println("From: " + base64reply_to);
+
errlog = errlog + "To: " + to + "\n";
out.println("To: " + to);
- errlog = errlog + "Reply-To: " + reply_to + "\n";
- out.println("Reply-To: " + reply_to);
+
+ errlog = errlog + "Reply-To: " + base64reply_to + "\n";
+ out.println("Reply-To: " + base64reply_to);
if (cc != null) {
errlog = errlog + "Cc: " + cc + "\n";
@@ -151,7 +156,6 @@
out.println("Bcc: " + bcc);
}
- BCodec encoder = new BCodec(charset);
String base64Subject = encoder.encode(subject);
errlog = errlog +"Subject: " + base64Subject + "\n";
out.println("Subject: " + base64Subject);
@@ -228,7 +232,16 @@
*/
public void From(String from) {
this.from = from;
+
+ if (from == null) {
+ return;
+ }
+ if (from.indexOf("<") > 0) {
+ this.from = from.substring(from.indexOf("<")+1, from.length()-1);
+ }
+
}
+
/**
* DOCUMENT ME!
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org