Skip to content

Commit 21d5b24

Browse files
committed
Additional plugin usage examples and documentation
1 parent 818936e commit 21d5b24

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

emailproxy.config

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,20 @@ documentation = Local servers are specified as demonstrated below where, for exa
3939
/etc/letsencrypt/live/mail.example.net/privkey.pem) for the server you are using the proxy with, and it will use
4040
these to set up a secure connection between itself and your email client.
4141

42-
Experimental feature - proxy plugins:
43-
- Plugins are a semi-experimental new feature that enables the use of separate scripts to modify IMAP/SMTP commands
44-
when they are received from the client or server before passing through to the other side of the connection. The
45-
`plugins` property is a dictionary of one or more plugins, specified in the order that they should be applied to
46-
all received data, starting after authentication succeeds. Plugins are chained, so they can both edit incoming
47-
messages; and, use these as triggers to initiate their own communication with the server without any need to reveal
48-
this to the client (for example: client -> p1 -> p2 -> server -> p2 -> server -> p2 -> p1 -> client). Each key of
49-
the `plugins` property must be the name of a plugin you want to apply (note: the plugin's filename and its main
50-
class name must be identical). Each value should either be an empty dictionary if the plugin has no setup arguments;
51-
or, a set of key-value pairs to match the plugin's named initialisation parameters. See the [IMAP-2995] example
52-
below, which loads the IMAPIgnoreSentMessageUpload plugin with its `target_mailboxes` configured to match Gmail's
53-
`Sent Mail` mailbox. For further details and documentation, see the range of sample plugins.
42+
Advanced feature - proxy plugins:
43+
- Plugins are an advanced feature that enable the use of separate scripts to modify IMAP/POP/SMTP commands when they
44+
are received from the client or server before passing through to the other side of the connection. The `plugins`
45+
property is an dictionary of one or more plugins, specified in the order that they should be applied to all received
46+
data. On the client side of the connection plugins are run in the order shown; on the server side plugins are run in
47+
reverse order. On the server side, plugins can be used at any point, but for security reasons plugins on the client
48+
side are inserted after authentication has succeeded. Plugins are chained, so they can both edit incoming messages;
49+
and, use these as triggers to initiate their own communication with the server without any need to reveal this to
50+
the client (for example: client -> p1 -> p2 -> server -> p2 -> server -> p2 -> p1 -> client). Each key of the
51+
`plugins` property must be the name of a plugin you want to apply (note: the plugin's filename and its main class
52+
name must be identical). Each value should either be an empty dictionary if the plugin has no setup arguments; or,
53+
a set of key-value pairs to match the plugin's named initialisation parameters. See the [IMAP-1994] and [IMAP-1995]
54+
entries below for example plugin configurations. For further details and documentation, see the range of sample
55+
plugins at https://github.com/simonrob/email-oauth2-proxy/tree/plugins/plugins.
5456

5557
[IMAP-1993]
5658
server_address = outlook.office365.com
@@ -84,9 +86,23 @@ server_port = 465
8486
local_address = 127.0.0.1
8587

8688
[IMAP-1994]
89+
server_address = outlook.office365.com
90+
server_port = 993
91+
local_address = 127.0.0.1
92+
plugins = {
93+
'IMAPFixO365SearchQuirks': {},
94+
'IMAPIgnoreSentMessageUpload': {'target_mailboxes': ['Sent Items']},
95+
'IMAPLinkDestinationRevealer': {},
96+
'IMAPCleanO365ATPLinks': {}
97+
}
98+
99+
[IMAP-2994]
87100
server_address = imap.gmail.com
88101
server_port = 993
89-
plugins = {'IMAPIgnoreSentMessageUpload': {'target_mailboxes': ['[Gmail]/Sent Mail', '[Google Mail]/Sent Mail']}}
102+
plugins = {
103+
'IMAPIgnoreSentMessageUpload': {'target_mailboxes': ['[Google Mail]/Sent Mail', '[Gmail]/Sent Mail']},
104+
'IMAPDeflateCompressionRemoteEnabler': {}
105+
}
90106

91107

92108
[Account setup]
@@ -169,7 +185,7 @@ documentation = Accounts are specified using your email address as the section h
169185
service account with the proxy in a publicly-accessible context is not advised. You are highly encouraged to
170186
enable the proxy's secret encryption option (see `encrypt_client_secret_on_first_use` at the end of this file)
171187
and consider pre-encrypting account entries. A sample pre-encryption script is provided for reference at
172-
https://github.com/simonrob/email-oauth2-proxy/issues/212#issuecomment-1867557029
188+
https://github.com/simonrob/email-oauth2-proxy/issues/212#issuecomment-1867557029.
173189

174190
Advanced account configuration:
175191
- For most configurations the default `redirect_uri` value of `http://localhost` is correct, unless you have

plugins/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Email OAuth 2.0 Proxy plugins
22
Plugins are an advanced Email OAuth 2.0 Proxy feature that enable the use of separate scripts to modify IMAP/POP/SMTP commands when they are received from the client or server before passing through to the other side of the connection.
33
This allows a wide range of additional capabilities or triggers to be added the proxy, as demonstrated in the examples below.
4+
See the [sample configuration file](../emailproxy.config#L42) for further application examples and documentation.
45

56

67
## Sample plugins

0 commit comments

Comments
 (0)