-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from gotthardp/lukebakken/add-samples
Add sample MIME data
- Loading branch information
Showing
65 changed files
with
4,584 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,5 +18,4 @@ plugins/ | |
sbin/ | ||
tmp/ | ||
|
||
test/system_SUITE_data/samples* | ||
test/TEST-*.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
// SmtpServer.java | ||
// | ||
// Usage: | ||
// | ||
// java SmtpServer <IP address> [<port>] | ||
// | ||
// port is optional, default port is 25 | ||
// output is to console and to file msg.txt | ||
// | ||
|
||
import java.io.*; | ||
import java.net.*; | ||
|
||
|
||
public class SmtpServer extends Thread { | ||
|
||
InetAddress mAddress; | ||
Socket mSocket; | ||
|
||
|
||
public SmtpServer(Socket aSocket, InetAddress aAddress) { | ||
mSocket = aSocket; | ||
mAddress = aAddress; | ||
} | ||
|
||
|
||
public void run() { | ||
try { | ||
go(); | ||
} | ||
catch (Exception e) { | ||
System.out.println(e); | ||
} | ||
try { | ||
mSocket.close(); | ||
} | ||
catch (IOException e) { | ||
System.out.println(e); | ||
} | ||
} | ||
|
||
|
||
public void go() throws Exception { | ||
FileOutputStream outFileStrm = new FileOutputStream("msg.txt"); | ||
PrintWriter outFile = new PrintWriter(outFileStrm); | ||
InputStream inStrm = mSocket.getInputStream(); | ||
OutputStream outStrm = mSocket.getOutputStream(); | ||
BufferedReader in = new BufferedReader(new InputStreamReader(inStrm)); | ||
PrintWriter out = new PrintWriter(new OutputStreamWriter(outStrm)); | ||
System.out.println("Connected to "+ | ||
mSocket.getInetAddress().getHostAddress()); | ||
System.out.println("S: 220 "+mAddress); | ||
outFile.println("S: 220 "+mAddress); | ||
out.println("220 "+mAddress); | ||
out.flush(); | ||
loop: | ||
while (true) { | ||
String line = in.readLine(); | ||
if (line.startsWith("HELO") | ||
|| line.startsWith("helo")) { | ||
System.out.println("C: "+line); | ||
outFile.println("C: "+line); | ||
System.out.println("S: 250 OK"); | ||
outFile.println("S: 250 OK"); | ||
out.println("250 OK"); | ||
out.flush(); | ||
} | ||
else if (line.startsWith("MAIL FROM:") | ||
|| line.startsWith("mail from:")) { | ||
System.out.println("C: "+line); | ||
outFile.println("C: "+line); | ||
System.out.println("S: 250 OK"); | ||
outFile.println("S: 250 OK"); | ||
out.println("250 OK"); | ||
out.flush(); | ||
} | ||
else if (line.startsWith("RCPT TO:") | ||
|| line.startsWith("rcpt to:")) { | ||
System.out.println("C: "+line); | ||
outFile.println("C: "+line); | ||
System.out.println("S: 250 OK"); | ||
outFile.println("S: 250 OK"); | ||
out.println("250 OK"); | ||
out.flush(); | ||
} | ||
else if (line.startsWith("DATA") | ||
|| line.startsWith("data")) { | ||
System.out.println("C: "+line); | ||
outFile.println("C: "+line); | ||
System.out.println("S: 354 End data with <CR><LF>.<CR><LF>"); | ||
outFile.println("S: 354 End data with <CR><LF>.<CR><LF>"); | ||
out.println("354 End data with <CR><LF>.<CR><LF>"); | ||
out.flush(); | ||
int lineCount = 0; | ||
while (true) { | ||
line = in.readLine(); | ||
if (line.equals(".")) { | ||
System.out.println("C: "+line); | ||
outFile.println("C: "+line); | ||
System.out.println("S: 250 OK"); | ||
outFile.println("S: 250 OK"); | ||
out.println("250 OK"); | ||
out.flush(); | ||
break; | ||
} | ||
else { | ||
System.out.println("C: "+line); | ||
outFile.println("C: "+line); | ||
} | ||
++lineCount; | ||
} | ||
} | ||
else if (line.startsWith("QUIT") | ||
|| line.startsWith("quit")) { | ||
System.out.println("C: "+line); | ||
outFile.println("C: "+line); | ||
System.out.println("S: 221 Bye"); | ||
outFile.println("S: 221 Bye"); | ||
out.println("221 Bye"); | ||
out.flush(); | ||
break loop; | ||
} | ||
else if (line.startsWith("EHLO") | ||
|| line.startsWith("ehlo")) { | ||
System.out.println("C: "+line); | ||
outFile.println("C: "+line); | ||
System.out.println("S: 500 Unknown command"); | ||
outFile.println("S: 500 Unknown command"); | ||
out.println("500 Unknown command"); | ||
out.flush(); | ||
} | ||
else if (line.startsWith("RSET") | ||
|| line.startsWith("rset")) { | ||
System.out.println("C: "+line); | ||
outFile.println("C: "+line); | ||
System.out.println("S: 250 OK"); | ||
outFile.println("S: 250 OK"); | ||
out.println("250 OK"); | ||
out.flush(); | ||
} | ||
else { | ||
System.out.println("C: "+line); | ||
outFile.println("C: "+line); | ||
System.out.println("S: 500 Unknown command"); | ||
outFile.println("S: 500 Unknown command"); | ||
out.println("500 Unknown command"); | ||
out.flush(); | ||
} | ||
} | ||
outFile.close(); | ||
outFileStrm.close(); | ||
} | ||
|
||
|
||
public static void main(String[] args) { | ||
if (args.length < 1) { | ||
System.out.println("Usage: java SmtpServer address [port]"); | ||
System.exit(1); | ||
} | ||
try { | ||
InetAddress addr = InetAddress.getByName(args[0]); | ||
int port = 25; | ||
if (args.length > 1) { | ||
port = Integer.parseInt(args[1]); | ||
} | ||
ServerSocket serverSocket = new ServerSocket(port, 5, addr); | ||
while (true) { | ||
System.out.println("Waiting for connection on "+ | ||
addr.getHostAddress()+":"+port); | ||
Socket socket = serverSocket.accept(); | ||
try { | ||
SmtpServer serverThread = new SmtpServer(socket, addr); | ||
serverThread.start(); | ||
} | ||
catch (Exception e) { | ||
System.out.println("Whoops!"); | ||
} | ||
} | ||
} | ||
catch (Exception e) { | ||
System.out.println(e); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Die Hasen und die Fr�sche | ||
|
||
Die Hasen klagten einst �ber ihre mi�liche Lage; "wir leben", sprach ein Redner, "in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist �rger als der Tod selbst. Auf, la�t uns ein f�r allemal sterben." | ||
|
||
In einem nahen Teich wollten sie sich nun ers�ufen; sie eilten ihm zu; allein das au�erordentliche Get�se und ihre wunderbare Gestalt erschreckte eine Menge Fr�sche, die am Ufer sa�en, so sehr, da� sie aufs schnellste untertauchten. | ||
|
||
"Halt", rief nun eben dieser Sprecher, "wir wollen das Ers�ufen noch ein wenig aufschieben, denn auch uns f�rchten, wie ihr seht, einige Tiere, welche also wohl noch ungl�cklicher sein m�ssen als wir." | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
The Farmer and the Stork | ||
|
||
A FARMER placed nets on his newly-sown plowlands and caught a | ||
number of Cranes, which came to pick up his seed. With them he | ||
trapped a Stork that had fractured his leg in the net and was | ||
earnestly beseeching the Farmer to spare his life. "Pray save | ||
me, Master," he said, "and let me go free this once. My broken | ||
limb should excite your pity. Besides, I am no Crane, I am a | ||
Stork, a bird of excellent character; and see how I love and | ||
slave for my father and mother. Look too, at my feathers-- | ||
they are not the least like those of a Crane." The Farmer | ||
laughed aloud and said, "It may be all as you say, I only know | ||
this: I have taken you with these robbers, the Cranes, and you | ||
must die in their company." | ||
|
||
Birds of a feather flock together. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
The Hare and the Tortoise | ||
|
||
A HARE one day ridiculed the short feet and slow pace of the Tortoise, who replied, laughing: "Though you be swift as the wind, I will beat you in a race." The Hare, believing her assertion to be simply impossible, assented to the proposal; and they agreed that the Fox should choose the course and fix the goal. On the day appointed for the race the two started together. The Tortoise never for a moment stopped, but went on with a slow but steady pace straight to the end of the course. The Hare, lying down by the wayside, fell fast asleep. At last waking up, and moving as fast as he could, he saw the Tortoise had reached the goal, and was comfortably dozing after her fatigue. | ||
|
||
Slow but steady wins the race. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
The Wolf and the Lamb | ||
|
||
WOLF, meeting with a Lamb astray from the fold, resolved not to | ||
lay violent hands on him, but to find some plea to justify to the | ||
Lamb the Wolf's right to eat him. He thus addressed him: | ||
"Sirrah, last year you grossly insulted me." "Indeed," bleated | ||
the Lamb in a mournful tone of voice, "I was not then born." Then | ||
said the Wolf, "You feed in my pasture." "No, good sir," replied | ||
the Lamb, "I have not yet tasted grass." Again said the Wolf, | ||
"You drink of my well." "No," exclaimed the Lamb, "I never yet | ||
drank water, for as yet my mother's milk is both food and drink | ||
to me." Upon which the Wolf seized him and ate him up, saying, | ||
"Well! I won't remain supperless, even though you refute every | ||
one of my imputations." The tyrant will always find a pretext for | ||
his tyranny. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
From: "Doug Sauder" <[email protected]> | ||
To: "J�rgen Schm�rgen" <[email protected]> | ||
Subject: Die Hasen und die Fr�sche (Microsoft Outlook 00) | ||
Date: Wed, 17 May 2000 19:08:29 -0400 | ||
Message-ID: <[email protected]> | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain; | ||
charset="iso-8859-1" | ||
Content-Transfer-Encoding: 8bit | ||
X-Priority: 3 (Normal) | ||
X-MSMail-Priority: Normal | ||
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) | ||
Importance: Normal | ||
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 | ||
|
||
Die Hasen und die Fr�sche | ||
|
||
Die Hasen klagten einst �ber ihre mi�liche Lage; "wir leben", sprach ein | ||
Redner, "in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der | ||
Adler, ja fast aller Raubtiere! Unsere stete Angst ist �rger als der Tod | ||
selbst. Auf, la�t uns ein f�r allemal sterben." | ||
|
||
In einem nahen Teich wollten sie sich nun ers�ufen; sie eilten ihm zu; | ||
allein das au�erordentliche Get�se und ihre wunderbare Gestalt erschreckte | ||
eine Menge Fr�sche, die am Ufer sa�en, so sehr, da� sie aufs schnellste | ||
untertauchten. | ||
|
||
"Halt", rief nun eben dieser Sprecher, "wir wollen das Ers�ufen noch ein | ||
wenig aufschieben, denn auch uns f�rchten, wie ihr seht, einige Tiere, | ||
welche also wohl noch ungl�cklicher sein m�ssen als wir." | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
From: "Doug Sauder" <[email protected]> | ||
To: "J�rgen Schm�rgen" <[email protected]> | ||
Subject: Die Hasen und die Fr�sche (Microsoft Outlook 00) | ||
Date: Wed, 17 May 2000 19:10:31 -0400 | ||
Message-ID: <[email protected]> | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain; | ||
charset="iso-8859-1" | ||
Content-Transfer-Encoding: quoted-printable | ||
X-Priority: 3 (Normal) | ||
X-MSMail-Priority: Normal | ||
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) | ||
Importance: Normal | ||
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 | ||
|
||
Die Hasen und die Fr=F6sche | ||
|
||
Die Hasen klagten einst =FCber ihre mi=DFliche Lage; "wir leben", sprach = | ||
ein Redner, "in steter Furcht vor Menschen und Tieren, eine Beute der = | ||
Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist = | ||
=E4rger als der Tod selbst. Auf, la=DFt uns ein f=FCr allemal sterben."=20 | ||
|
||
In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu; = | ||
allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt = | ||
erschreckte eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF = | ||
sie aufs schnellste untertauchten.=20 | ||
|
||
"Halt", rief nun eben dieser Sprecher, "wir wollen das Ers=E4ufen noch = | ||
ein wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige = | ||
Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
From: "Doug Sauder" <[email protected]> | ||
To: "J�rgen Schm�rgen" <[email protected]> | ||
Subject: Die Hasen und die Fr�sche (Microsoft Outlook 00) | ||
Date: Wed, 17 May 2000 19:11:50 -0400 | ||
Message-ID: <[email protected]> | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain; | ||
charset="iso-8859-1" | ||
Content-Transfer-Encoding: base64 | ||
X-Priority: 3 (Normal) | ||
X-MSMail-Priority: Normal | ||
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) | ||
Importance: Normal | ||
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 | ||
|
||
RGllIEhhc2VuIHVuZCBkaWUgRnL2c2NoZQ0KDQpEaWUgSGFzZW4ga2xhZ3RlbiBlaW5zdCD8YmVy | ||
IGlocmUgbWnfbGljaGUgTGFnZTsgIndpciBsZWJlbiIsIHNwcmFjaCBlaW4gUmVkbmVyLCAiaW4g | ||
c3RldGVyIEZ1cmNodCB2b3IgTWVuc2NoZW4gdW5kIFRpZXJlbiwgZWluZSBCZXV0ZSBkZXIgSHVu | ||
ZGUsIGRlciBBZGxlciwgamEgZmFzdCBhbGxlciBSYXVidGllcmUhIFVuc2VyZSBzdGV0ZSBBbmdz | ||
dCBpc3Qg5HJnZXIgYWxzIGRlciBUb2Qgc2VsYnN0LiBBdWYsIGxh33QgdW5zIGVpbiBm/HIgYWxs | ||
ZW1hbCBzdGVyYmVuLiIgDQoNCkluIGVpbmVtIG5haGVuIFRlaWNoIHdvbGx0ZW4gc2llIHNpY2gg | ||
bnVuIGVyc+R1ZmVuOyBzaWUgZWlsdGVuIGlobSB6dTsgYWxsZWluIGRhcyBhdd9lcm9yZGVudGxp | ||
Y2hlIEdldPZzZSB1bmQgaWhyZSB3dW5kZXJiYXJlIEdlc3RhbHQgZXJzY2hyZWNrdGUgZWluZSBN | ||
ZW5nZSBGcvZzY2hlLCBkaWUgYW0gVWZlciBzYd9lbiwgc28gc2VociwgZGHfIHNpZSBhdWZzIHNj | ||
aG5lbGxzdGUgdW50ZXJ0YXVjaHRlbi4gDQoNCiJIYWx0IiwgcmllZiBudW4gZWJlbiBkaWVzZXIg | ||
U3ByZWNoZXIsICJ3aXIgd29sbGVuIGRhcyBFcnPkdWZlbiBub2NoIGVpbiB3ZW5pZyBhdWZzY2hp | ||
ZWJlbiwgZGVubiBhdWNoIHVucyBm/HJjaHRlbiwgd2llIGlociBzZWh0LCBlaW5pZ2UgVGllcmUs | ||
IHdlbGNoZSBhbHNvIHdvaGwgbm9jaCB1bmds/GNrbGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIu | ||
IiANCg== | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
From: "Doug Sauder" <[email protected]> | ||
To: =?iso-8859-1?B?SvxyZ2VuIFNjaG38cmdlbg==?= <[email protected]> | ||
Subject: =?iso-8859-1?Q?Die_Hasen_und_die_Fr=F6sche_=28Microsoft_Outlook_00=29?= | ||
Date: Wed, 17 May 2000 19:13:51 -0400 | ||
Message-ID: <[email protected]> | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain; | ||
charset="iso-8859-1" | ||
Content-Transfer-Encoding: 8bit | ||
X-Priority: 3 (Normal) | ||
X-MSMail-Priority: Normal | ||
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) | ||
Importance: Normal | ||
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 | ||
|
||
Die Hasen und die Fr�sche | ||
|
||
Die Hasen klagten einst �ber ihre mi�liche Lage; "wir leben", sprach ein | ||
Redner, "in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der | ||
Adler, ja fast aller Raubtiere! Unsere stete Angst ist �rger als der Tod | ||
selbst. Auf, la�t uns ein f�r allemal sterben." | ||
|
||
In einem nahen Teich wollten sie sich nun ers�ufen; sie eilten ihm zu; | ||
allein das au�erordentliche Get�se und ihre wunderbare Gestalt erschreckte | ||
eine Menge Fr�sche, die am Ufer sa�en, so sehr, da� sie aufs schnellste | ||
untertauchten. | ||
|
||
"Halt", rief nun eben dieser Sprecher, "wir wollen das Ers�ufen noch ein | ||
wenig aufschieben, denn auch uns f�rchten, wie ihr seht, einige Tiere, | ||
welche also wohl noch ungl�cklicher sein m�ssen als wir." | ||
|
Oops, something went wrong.