rjo1970 / dumbster Goto Github PK
View Code? Open in Web Editor NEWDumbster Fake SMTP Server
License: Apache License 2.0
Dumbster Fake SMTP Server
License: Apache License 2.0
(This is a continuation of issue #2 that I cannot re-open.)
I finally found from where these Subject line truncation happened. According to the RFC 2822 section 2.2.3 the lines of a message shouldn't be longer than 78 characters. For that reason it's possible to put a CRLF in any header line that is longer than 78, as I observed when looking at the offending email source in Thunderbird:
...
Message-ID: <9637901.1.1314596564608.JavaMail.Administrator@auto-win2003>
Subject: Funnelback Reports for: Se2-ReportingEmail (_default) [29 August
2011]
MIME-Version: 1.0
...
It turns out that the mail.jar
that comes with Dumbster (and used for the unit tests) seems to be v1.3.0, whereas my app is using v1.4.2. When I upgrade mail.jar
to 1.4.2 on Dumbster I can reproduce the problem. I've created a branch showing it here: https://github.com/nguillaumin/dumbster/tree/headers-linebreak
So I guess the header / data parsing code will need to be updated to account for that 78 characters limit...
Cheers,
Nico
The appendBody method in MailMessageImpl is not honoring newlines in multi-lined messages. The origin of the problem is that the readLine() method in BufferedReader strips the newline so it is not being added to the StringBuffer. After playing around with it, the following seems to work (at least for my use case):
public void appendBody(String line) {
if(body.length() > 0 && line.length() > 0 && !"\n".equals(line)) {
body.append('\n');
}
body.append(line);
}
java -jar dumbster-1.9.0.2-SNAPSHOT.jar --mailStore=mailstore 4039
Above command results into help text. It should start dumbster with mailstore.
We want to use dumbster by running with command line. And want to retrieve email from the mailstore.
Can you release this to Maven Central?
EMLMailStore and RollingMailStore are printing out received messages with a System.out.println()
.
This is not always wanted (in my case it's polluting my test logs) and I think an option to turn that off should be provided (or remove it completely if nobody is interested by that, we can print it ourselves in our tests if we need to).
Steps to reproduce:
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 localhost Dumbster SMTP service ready
Got a report that Subject lines over length 62 are truncated.
Bad-written clients, if hanged in the middle of the session, can cause the dumbster client thread exhausting. In fact, happens to us all the time in our test environment.
The solution is simple: SocketWrapper.java:
diff --git a/src/com/dumbster/smtp/SocketWrapper.java b/src/com/dumbster/smtp/SocketWrapper.java
index f18a1bc..cac3f6d 100644
--- a/src/com/dumbster/smtp/SocketWrapper.java
+++ b/src/com/dumbster/smtp/SocketWrapper.java
@@ -9,8 +9,9 @@ import java.net.Socket;
public class SocketWrapper implements IOSource {
private Socket socket;
- public SocketWrapper(Socket socket) {
+ public SocketWrapper(Socket socket) throws IOException {
this.socket = socket;
+ this.socket.setSoTimeout(10000); // protects against hanged clients
}
public BufferedReader getInputStream() throws IOException {
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.