Skip to content

Commit 4d1af39

Browse files
committed
Added a lot of documentation
1 parent b5109d5 commit 4d1af39

File tree

5 files changed

+87
-8
lines changed

5 files changed

+87
-8
lines changed

src/main/webapp/dist/app.bundle.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/webapp/dist/app.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/webapp/src/app/components/configuration/configuration.html

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ <h1>Configuration</h1>
44

55
<section class="introduction">
66
<p class="wide">
7-
Simple Java Mail provides full configuration through <strong>programmatic API</strong> as well as <strong>properties files</strong>. For each
8-
level of configuration detail, a constructor is available keep it simple.
7+
Simple Java Mail provides full configuration through <strong>programmatic API</strong> as well as <strong>system variables</strong>, <strong>environment
8+
variables</strong>
9+
and <strong>properties files</strong>. For each level of configuration detail, a simple constructor is available as well.
910
</p>
1011
<p class="wide">
1112
The Java API and config files complement each other; the more you configure in a properties file, the less you can provide through the
12-
programmatic API. If you provide the overlapping configuration, the programmatic API takes priority, overriding property values.
13+
programmatic API. If you provide the overlapping configuration, the programmatic API takes priority, overriding system and environment values,
14+
overriding property values.
1315
</p>
1416
</section>
1517

@@ -105,6 +107,10 @@ <h3>Other settings</h3>
105107
// change SOCKS5 bridge port in case of authenticated proxy
106108
Proxyconfig proxyConfig = new ProxyConfig(...);
107109
proxyConfig.setProxyBridgePort(1081); // is always localhost
110+
</code></pre>
111+
<pre><code>
112+
// change maximum number of threads when sending asynchronously
113+
mailer.setThreadPoolSize(20);
108114
</code></pre>
109115
</div>
110116
</section>
@@ -116,12 +122,21 @@ <h2>Properties files</h2>
116122
<section>
117123
<div class="view">
118124
<p>
119-
With properties files you can define defaults and overrides.
125+
With properties files you can define defaults and overrides. You can also provide overriding value by defining system variables.
120126
</p>
121127
<p>
122128
Simple Java Mail will automatically load properties from <code class="inline">simplejavamail.properties</code>, if available on the classpath.
123129
Alternatively, you can manually load additional properties files in a number of ways.
124130
</p>
131+
<p>
132+
Properties are loaded in order of priority from high to low:
133+
</p>
134+
<ol class="indent">
135+
<li>Programmatic values</li>
136+
<li>System variables</li>
137+
<li>Environment variables</li>
138+
<li>Properties from config files</li>
139+
</ol>
125140
</div>
126141

127142
<div class="side">
@@ -165,6 +180,7 @@ <h3>Available properties</h3>
165180
166181
simplejavamail.defaults.bcc.name=BCC Default
167182
183+
simplejavamail.defaults.poolsize=10
168184
</code></pre>
169185
</div>
170186
</section>

src/main/webapp/src/app/components/features/features.html

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ <h1>Simple Java Mail Features</h1>
3131
<li><a simplePageScroll href="#section-email-validation">Validating Email Addresses</a></li>
3232
<li><a simplePageScroll href="#section-generate-mimemessage">Generating a MimeMessage from an Email</a></li>
3333
<li><a simplePageScroll href="#section-parse-mimemessage">Generating an Email from a MimeMessage</a></li>
34+
<li><a simplePageScroll href="#section-proxy">Send using a proxy</a></li>
3435
</ul>
3536
</section>
3637

@@ -125,6 +126,32 @@ <h3>Configure once, reuse many times</h3>
125126
</section>
126127

127128

129+
<a href="#section-sending-asynchronously" id="section-sending-asynchronously" class="section-link h3">&sect;</a>
130+
<h3>Asynchronous parallel batch sending</h3>
131+
132+
<section>
133+
<div class="view">
134+
<p>
135+
The default mode is to send emails synchronously, blocking execution until the email was processed completely and the STMP server send a
136+
succesful result.
137+
</p>
138+
<p>
139+
You can also sent anyschronously in parallel or batches, or simply send in a fire-and-forget way. If an authenticated proxy is used, the <a
140+
simplePageScroll href="#section-proxy">proxy briding server</a> is kept alive until the last email has been sent.</p>
141+
<p>
142+
Depending on the SMTP server (and proxy server if used) this can greatly influence how fast emails are sent.
143+
</p>
144+
</div>
145+
146+
<div class="side">
147+
<pre><code>mailer.sendMail(email, true);
148+
</code></pre>
149+
<p>Refer to the <a simplePageScroll [routerLink]="['/configuration']" simplePageScroll href="#section-other-settings">configuration section</a>
150+
on how to set the thread pool size default.</p>
151+
</div>
152+
</section>
153+
154+
128155
<a href="#section-custom-session" id="section-custom-session" class="section-link h2">&sect;</a>
129156
<h2>Sending with your own Session instance</h2>
130157

@@ -403,4 +430,39 @@ <h2>Generating an Email from a MimeMessage</h2>
403430
</div>
404431
</section>
405432

433+
434+
<a href="#section-proxy" id="section-proxy" class="section-link h2">&sect;</a>
435+
<h2>Send using a proxy</h2>
436+
437+
<section>
438+
<div class="view">
439+
<p>
440+
Simple Java Mail supports sending emails through a proxy. It is also the only java mailing framework in the world that supports sending emails
441+
through <strong>authenticated</strong> proxies.
442+
</p>
443+
<p>
444+
The reason for this is that the underlying native <a href="https://java.net/projects/javamail/pages/Home">Javax Mail framework</a> supports
445+
anonymous SOCKS5 proxies, but <a href="http://www.oracle.com/technetwork/java/javamail/faq/index.html#proxy">not authenticated proxies</a>.
446+
</p>
447+
<p>
448+
To make this work with authentication, Simple Java Mail uses a trick: it sets up a temporary anonymous proxy server for Javax Mail to connect
449+
to and then relays the connection to the target proxy performing the authentication outside of Javax Mail.
450+
</p>
451+
<p>
452+
This temporary server is referred to as the <strong>Proxy Bridging Server</strong>.
453+
</p>
454+
</div>
455+
456+
<div class="side">
457+
<pre><code>// anonymous proxy
458+
new Mailer(serverConfig, new ProxyConfig("proxy.host.com", 1080));
459+
460+
// authenticated proxy
461+
new Mailer(serverConfig, new ProxyConfig("proxy.host.com", 1080, "proxy username", "proxy password"));
462+
</code></pre>
463+
<p>Refer to the <a simplePageScroll [routerLink]="['/configuration']" simplePageScroll href="#section-other-settings">configuration section</a>
464+
on how to set proxy server defaults and the port on which the proxy bridge runs.</p>
465+
</div>
466+
</section>
467+
406468
</div>

src/main/webapp/src/app/components/features/features.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import {Component} from '@angular/core';
22
import {SimplePageScroll, SimplePageScrollConfig} from 'ng2-simple-page-scroll';
3+
import {ROUTER_DIRECTIVES} from '@angular/router'; // needed for SimplePageScroll to nav to other views
34

45
@Component({
56
template: require('app/components/features/features.html'),
6-
directives: [SimplePageScroll]
7+
directives: [ROUTER_DIRECTIVES, SimplePageScroll]
78
})
89

910
export class Features {

0 commit comments

Comments
 (0)