forked from linagora/Greenmail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
readme.html
124 lines (103 loc) · 5.96 KB
/
readme.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>GreenMail - Email Test Servers</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css" />
</head>
<body>
<div id="header">
<img src="pics/greenmail.gif" title="GreenMail - Testing SMTP, POP3, IMAP">
Latest Release GreenMail v1.3.1b - May 27th, 2009
</div>
<div class="pages">
<span class="page"><a href="readme.html">About</a></span>
| <span class="page"><a href="examples.html">Examples</a></span>
| <span class="page"><a href="faq.html">FAQ</a></span>
| <span class="page"><a href="javadocs/index.html">Javadocs</a></span>
| <span class="page"><a href="http://www.icegreen.com/articles">Blog</a></span>
| <span class="page"><a href="http://sourceforge.net/project/showfiles.php?group_id=159695">Download</a></span>
| <span class="page"><a href="feedback.html">Feedback</a></span>
</div>
<br>
<table width="100%">
<tr><td>
<h2>Easy to use</h2>
GreenMail is an open source, intuitive and easy-to-use test suite of email servers for testing purposes.
<br>Supports SMTP, POP3, IMAP with SSL socket support. GreenMail also provides a JBoss GreenMail Service.
<p>
GreenMail is the fist and only library that offers a test framework for both receiving and retrieving emails from Java.
</p>
<h2>Scenarios</h2>
GreenMail is useful in the following scenarios:
<h3>Test Your Sending Code</h3>
<ul>
<li>System testing an application. GreenMail responds like a regular SMTP server but does not deliver any email, which enables it to be used in real life applications and real test cases. Messages can easily be extracted, verified, and modified. Support for SMTPS (SSL) is enabled. </li>
<li>GreenMail is an excellent choice for unit testing code that needs to send email with a succinct, efficient (non-polling) way to wait for messages to arrive, retrieve, verify, and modify messages. </li>
<li>Note that retrieval of emails can be made with a simple java method or through a provided POP3, IMAP retriever helper class.</li>
</ul>
<div class="codeSample"><pre>
public void testYourSendingCode() throws Exception {
GreenMail greenMail = new GreenMail(); //uses test ports by default
greenMail.start();
GreenMailUtil.sendTextEmailTest("to@localhost.com", "from@localhost.com", "subject", "body"); //replace this with your send code
assertEquals("body", GreenMailUtil.getBody(greenMail.getReceivedMessages()[0]));
greenMail.stop();
//<b>That's it!</b>
}
</pre>
</div>
<h3>Test Your Retrieving Code</h3>
<ul>
<li>Again GreenMail can be used for system or unit testing an application needing to use POP3 or IMAP by responding like a standard compliant POP3 or IMAP server. Support for POP3S and IMAPS (SSL) is also enabled. </li>
<li>Messages can be placed directly in users mailboxes or by using SMTP.</li>
<li>GreenMail ships with helper classes for sending and retrieving. See the javadocs for the <a href="javadocs/com/icegreen/greenmail/util/Retriever.html">Retriever.java</a> class</li>
</ul>
<div class="codeSample"><pre>
public void testYourRetrievingCode() throws Exception {
GreenMail greenMail = new GreenMail(); //uses test ports by default
greenMail.start();
MimeMessage message = <b><CONSTRUCT MESSAGE ></b>
User user = greenMail.setUser("to@localhost.com", "login-id", "password");
user.deliver(message);
GreenMailUtil.sendTextEmailTest("to@localhost.com", "from@localhost.com", subject, body);
assertEquals(<b>2</b>, greenMail.getReceivedMessages().length);
<b><PLACE YOUR POP3/IMAP RETRIVE CODE HERE></b>
}
</pre>
</div>
<h3>Sending and Retrieving</h3>
GreenMail can easily be configured to use all or a combination of ports, protocols, and bind addresses. For example it’s possible to run GreenMail on SMTP, POP3, POP3S and IMAPS ports as easily as only SMTP.
Many systems might already be running these servers or don’t allow non root users to open the default ports which is why GreenMail ships with a special configuration for testing.
<h3>Mocking a mail server for your development environment</h3>
GreenMail provides a <a href="jboss-service.html">JBoss GreenMail service</a> for mocking a mail server for development.
It safes you the overhead of either installing a full productive server (like <a href="http://james.apache.org/">Apache James</a> or <a href="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossMailServer">JBoss Mail</a>).
<h2>Implementation</h2>
The implementation is in 100% Java with only a few library dependencies:
<ul>
<li>javamail.jar - <a href="http://java.sun.com/products/javamail/">JavaMail API</a></li>
<li>activation.jar - <a href="http://java.sun.com/products/javabeans/jaf/index.jsp">Java Activation Framework</a>, required by JavaMail</li>
<li>slf4j-api.jar - required for logging via <a href="http://www.slf4j.org/">Simple Logging Facade for Java</a></li>
</ul>
<br>
<h2>Source Code</h2>
GreenMail is open source released under <a href="http://www.apache.org/licenses/LICENSE-2.0.txt" rel="nofollow">The Apache 2.0 License</a>.
Binaries and source can be downloaded <a href="">here on Sourceforge</a>.
<p>
GreenMail's protocol source code is based on a cocktail of <a href="http://foedus.sourceforge.net" rel="nofollow">Foedus</a> and <a href="http://james.apache.org" rel="nofollow">James</a>.
</p>
</td>
<td class="gads">
</td>
</tr>
</table>
<br>
<br>
<br>
<div class="footer">
Copyright © 2009 <a href="http://www.icegreen.com">Icegreen Technologies</a>
<br><br>
<a href="http://sourceforge.net/donate/index.php?group_id=159695"><img src="http://images.sourceforge.net/images/project-support.jpg" width="88" height="32" border="0" alt="Support This Project" /> </a>
<a href="http://sourceforge.net"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=159695&type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a>
</div>
</body>
</html>