SlideShare a Scribd company logo
1/
On premise
email inbound service
with Apache James
2/
About me
Backend software engineer @linagoraVN
- Java / Scala developer
- Solution architect
- Apache James Chairman
- email expert
- Apache Cassandra fan-boy
- Loves distributed computing topics.
3/
About Linagora Vietnam
Office in Vietnam since 2015
Offers alternative for collaborative suites.
Why ? => Digital sovereignty through OpenSource
TMail
4/
About Apache James
Apache project since 2007
→ Implements multiple Email standards: SMTP, IMAP, JMAP, etc…
→ Scaling infrastucture available
(Cassandra, S3, OpenSearch, RabbitMQ)
→ Flexibility: Extensions, and toolbox to assemble your own email server.
5/
What’s in a mail?
Date: Tue, 03 Jan 2017 16:05:01 +0100
From: sender <sender@james.org>
MIME-Version: 1.0
To: David DOLCIMASCOLO <david.ddo@linagora.com>
Subject: Re: [Internet] Rendez-vous
References: <9b6a4271-69fb-217a-5c14-c68c68375d96@linagora.com>
In-Reply-To: <d5c6f1d6-96e7-8172-9fe6-41fa6c9bd6ec@linagora.com>
X-Gie-Attachments: none
Cc:
Content-type: multipart/mixed; boundary="----------=_1483455916-7086-3"
This is a multi-part message in MIME format...
------------=_1483455916-7086-3
Content-Type: multipart/alternative; boundary="------------060506070600060108040700"
This is a multi-part message in MIME format.
--------------060506070600060108040700
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
/blabla/
*bloblo*
--------------060506070600060108040700
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<i>blabla</i>
<b>bloblo</b>
--------------060506070600060108040700--
------------=_1483455916-7086-3
Content-ID: <14672787885774e5c4d4cee471352039@linagora.com>
Content-Type: text/plain; charset="iso-8859-1"; name="avertissement.txt"
Content-Disposition: inline; filename="avertissement.txt"
Content-Transfer-Encoding: binary
inline attachment
------------=_1483455916-7086-3--
Mime stucture:
- header / body
- single body VS multipart
- Each part have its header
- Nested multiparts
Parsing this can QUICKLY
become a mess!
CTRL + U in
thunderbird
6/
Reminder about email protocols
MTA MX
DNS
MX MDA
proxy
IMAP
SMTPS
Bob’s MUA
Webmail
Alice MUA
Thunderbird
Open standards (RFCs)
No vendor lock in.
SMTP
(opportunistic
STARTTLS upgrade)
SMTPS
(authenticated)
SMTPS
MX record
lookup
Vocabulary:
- MTA: Mail Transfer Agent
- MX: Mail eXchange
- MDA: Mail Delivery Agent
- MUA: Mail User Agent
- SMTP: Simple Mail Transport Protocol
- IMAP: Internet Message Access Protocol
7/
JMAP: The new kid in town
MX MDA
JMAP
SMTPS
Bob’s MUA
Webmail
Open standards (RFCs)
No vendor lock in
https://jmap.io/
SMTP
(opportunistic
STARTTLS upgrade)
→ Newly standardized
→ HTTP + JSON
→ Native Push and synchronization
→ Unifies IMAP and SMTP
→ Easy and efficient to use!
8/
Inbound VS outbound
My App
Bob
(user)
My app sends email:
Outbound
My app receives email:
Inbound
9/
Inbound: example of feature
The SMTP server added the
event in my calendar!
10/
Inbound: Other examples
List-Unsubscribe: <mailto:announce-unsubscribe@apache.org>
SMTP
server
helpdesk@company.com
11/
James Architecture
SMTP stack Mail
Queue
IMAP stack
Mail Processing
Mailbox
Remote
Delivery
12/
James Architecture (sorry)
SMTP stack Mail
Queue
Mail Processing
Use of eg James JPA-SMTP devoted to custom mail processing.
My
Stuff
13/
James Mail Processing
Vocabulary:
- Mailet: Action
- Matcher:Condition
- Processor: list of mailet and
matcher
The way mailetcontainer is
arranged is fully defined in
mailetcontainer.xml
Many pre-existing mailet / matchers.
14/
Custom mailet / matchers
- Loaded from external JAR
- Can use on James components
- Extensions can also inject their
own components.
15/
Security
- Sender address spoofing!
- Reverse DNS lookups
- SPF checks
- DKIM checks
All those are implemented in
Apache James
16/
James: Other places where behavior can be overriden
Feedback to an anti-spam
Transfer user attachments to third party apps
REST API, arbitrary operations.
EG email expiracy...
Checks
before the
mail queue
17/
James: A word of observability
- Orchestrable: Helm charts available
- Structured logs with applicative context
(JSON)
- Metrics (Prometheus)
www.linagora.com
Facebook : LINAGORA - Twitter : @linagora
Tour Franklin 31ème étage
100 Terrasse Boieldieu
92042 PARIS LA DEFENSE FRANCE
Tél. : +33 (0)1 46 96 63 63 - Fax : +33 (0)1 46 96 63 64
Thank you for your attention
CONTACT
Benoit TELLIER
Ingénieur Logiciel
btellier@linagora.com
+33 (0)6 77 26 04 58
Mobile, Signal, Whatsapp

More Related Content

Room 1 - 1 - Benoit TELLIER - On premise email inbound service with Apache James

  • 1. 1/ On premise email inbound service with Apache James
  • 2. 2/ About me Backend software engineer @linagoraVN - Java / Scala developer - Solution architect - Apache James Chairman - email expert - Apache Cassandra fan-boy - Loves distributed computing topics.
  • 3. 3/ About Linagora Vietnam Office in Vietnam since 2015 Offers alternative for collaborative suites. Why ? => Digital sovereignty through OpenSource TMail
  • 4. 4/ About Apache James Apache project since 2007 → Implements multiple Email standards: SMTP, IMAP, JMAP, etc… → Scaling infrastucture available (Cassandra, S3, OpenSearch, RabbitMQ) → Flexibility: Extensions, and toolbox to assemble your own email server.
  • 5. 5/ What’s in a mail? Date: Tue, 03 Jan 2017 16:05:01 +0100 From: sender <sender@james.org> MIME-Version: 1.0 To: David DOLCIMASCOLO <david.ddo@linagora.com> Subject: Re: [Internet] Rendez-vous References: <9b6a4271-69fb-217a-5c14-c68c68375d96@linagora.com> In-Reply-To: <d5c6f1d6-96e7-8172-9fe6-41fa6c9bd6ec@linagora.com> X-Gie-Attachments: none Cc: Content-type: multipart/mixed; boundary="----------=_1483455916-7086-3" This is a multi-part message in MIME format... ------------=_1483455916-7086-3 Content-Type: multipart/alternative; boundary="------------060506070600060108040700" This is a multi-part message in MIME format. --------------060506070600060108040700 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit /blabla/ *bloblo* --------------060506070600060108040700 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit <i>blabla</i> <b>bloblo</b> --------------060506070600060108040700-- ------------=_1483455916-7086-3 Content-ID: <14672787885774e5c4d4cee471352039@linagora.com> Content-Type: text/plain; charset="iso-8859-1"; name="avertissement.txt" Content-Disposition: inline; filename="avertissement.txt" Content-Transfer-Encoding: binary inline attachment ------------=_1483455916-7086-3-- Mime stucture: - header / body - single body VS multipart - Each part have its header - Nested multiparts Parsing this can QUICKLY become a mess! CTRL + U in thunderbird
  • 6. 6/ Reminder about email protocols MTA MX DNS MX MDA proxy IMAP SMTPS Bob’s MUA Webmail Alice MUA Thunderbird Open standards (RFCs) No vendor lock in. SMTP (opportunistic STARTTLS upgrade) SMTPS (authenticated) SMTPS MX record lookup Vocabulary: - MTA: Mail Transfer Agent - MX: Mail eXchange - MDA: Mail Delivery Agent - MUA: Mail User Agent - SMTP: Simple Mail Transport Protocol - IMAP: Internet Message Access Protocol
  • 7. 7/ JMAP: The new kid in town MX MDA JMAP SMTPS Bob’s MUA Webmail Open standards (RFCs) No vendor lock in https://jmap.io/ SMTP (opportunistic STARTTLS upgrade) → Newly standardized → HTTP + JSON → Native Push and synchronization → Unifies IMAP and SMTP → Easy and efficient to use!
  • 8. 8/ Inbound VS outbound My App Bob (user) My app sends email: Outbound My app receives email: Inbound
  • 9. 9/ Inbound: example of feature The SMTP server added the event in my calendar!
  • 10. 10/ Inbound: Other examples List-Unsubscribe: <mailto:announce-unsubscribe@apache.org> SMTP server helpdesk@company.com
  • 11. 11/ James Architecture SMTP stack Mail Queue IMAP stack Mail Processing Mailbox Remote Delivery
  • 12. 12/ James Architecture (sorry) SMTP stack Mail Queue Mail Processing Use of eg James JPA-SMTP devoted to custom mail processing. My Stuff
  • 13. 13/ James Mail Processing Vocabulary: - Mailet: Action - Matcher:Condition - Processor: list of mailet and matcher The way mailetcontainer is arranged is fully defined in mailetcontainer.xml Many pre-existing mailet / matchers.
  • 14. 14/ Custom mailet / matchers - Loaded from external JAR - Can use on James components - Extensions can also inject their own components.
  • 15. 15/ Security - Sender address spoofing! - Reverse DNS lookups - SPF checks - DKIM checks All those are implemented in Apache James
  • 16. 16/ James: Other places where behavior can be overriden Feedback to an anti-spam Transfer user attachments to third party apps REST API, arbitrary operations. EG email expiracy... Checks before the mail queue
  • 17. 17/ James: A word of observability - Orchestrable: Helm charts available - Structured logs with applicative context (JSON) - Metrics (Prometheus)
  • 18. www.linagora.com Facebook : LINAGORA - Twitter : @linagora Tour Franklin 31ème étage 100 Terrasse Boieldieu 92042 PARIS LA DEFENSE FRANCE Tél. : +33 (0)1 46 96 63 63 - Fax : +33 (0)1 46 96 63 64 Thank you for your attention CONTACT Benoit TELLIER Ingénieur Logiciel btellier@linagora.com +33 (0)6 77 26 04 58 Mobile, Signal, Whatsapp