-
Notifications
You must be signed in to change notification settings - Fork 0
/
mailwatcher.js
33 lines (30 loc) · 1.04 KB
/
mailwatcher.js
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
var mailin = require('mailin');
/* Event emitted when a connection with the Mailin smtp server is initiated. */
mailin.on('startMessage', function (messageInfo) {
/* messageInfo = {
from: '[email protected]',
to: '[email protected]',
connectionId: 't84h5ugf'
}; */
console.log(messageInfo);
});
/* Event emitted after a message was received and parsed.
* The message parameters contains the parsed email. */
mailin.on('message', function (message) {
console.log(message);
/* Do something useful with the parsed message here.
* Use it directly or modify it and post it to a webhook. */
});
/* Start the Mailin server. The available options are:
* options = {
* port: 25,
* webhook: 'http://mydomain.com/mailin/incoming,
* disableWebhook: false,
* logFile: '/some/local/path'
* };
* Here disable the webhook posting so that you can do what you want with the
* parsed message. */
mailin.start({
port: 25,
disableWebhook: true // Disable the webhook posting.
});