JAMES-2352 Null senders should be handled by James Mail processing

Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/d5f5e7fd
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/d5f5e7fd
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/d5f5e7fd

Branch: refs/heads/master
Commit: d5f5e7fdb73a2688bedb6f74dab4d2573f16301f
Parents: 9d6d42f
Author: benwa <btell...@linagora.com>
Authored: Wed Mar 21 10:34:02 2018 +0700
Committer: benwa <btell...@linagora.com>
Committed: Tue Mar 27 15:14:04 2018 +0700

----------------------------------------------------------------------
 .../main/java/org/apache/james/core/MailAddress.java   |  5 +++++
 .../java/org/apache/james/smtp/SmtpNullSenderTest.java | 13 +++++++++++++
 2 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/d5f5e7fd/core/src/main/java/org/apache/james/core/MailAddress.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/james/core/MailAddress.java 
b/core/src/main/java/org/apache/james/core/MailAddress.java
index 1a7540e..0dafb85 100644
--- a/core/src/main/java/org/apache/james/core/MailAddress.java
+++ b/core/src/main/java/org/apache/james/core/MailAddress.java
@@ -90,6 +90,11 @@ public class MailAddress implements java.io.Serializable {
         }
 
         @Override
+        public String asString() {
+            return "<>";
+        }
+
+        @Override
         public boolean isNullSender() {
             return true;
         }

http://git-wip-us.apache.org/repos/asf/james-project/blob/d5f5e7fd/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpNullSenderTest.java
----------------------------------------------------------------------
diff --git 
a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpNullSenderTest.java
 
b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpNullSenderTest.java
index 13b05be..b6b6d80 100644
--- 
a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpNullSenderTest.java
+++ 
b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpNullSenderTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.smtp;
 
 import static org.apache.james.mailets.configuration.Constants.DEFAULT_DOMAIN;
+import static org.apache.james.mailets.configuration.Constants.IMAP_PORT;
 import static org.apache.james.mailets.configuration.Constants.LOCALHOST_IP;
 import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.SMTP_PORT;
@@ -69,4 +70,16 @@ public class SmtpNullSenderTest {
             .sendMessageWithHeaders("", USER,"Short message")
             .awaitSent(awaitAtMostOneMinute);
     }
+
+    @Test
+    public void mailProcessingShouldDeliverNullSender() throws Exception {
+        messageSender.connect(LOCALHOST_IP, SMTP_PORT)
+            .sendMessageWithHeaders("", USER,"Short message")
+            .awaitSent(awaitAtMostOneMinute);
+
+        imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
+            .login(USER, PASSWORD)
+            .select(IMAPMessageReader.INBOX)
+            .awaitMessage(awaitAtMostOneMinute);
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to