blob: 1ac76a4ed26639df1740ef4debc9161d933c45e1 (
plain)
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
|
const { ipcMain } = require('electron');
const { ImapFlow } = require('imapflow');
ipcMain.on('imap:listTree:from', listTreeFrom);
ipcMain.on('imap:listTree:to', listTreeTo);
async function connect (options) {
const client = new ImapFlow({
host: options.server,
port: options.port,
auth: {
user: options.username,
pass: options.password,
},
});
await client.connect();
return client;
}
async function listTreeFrom (event, options) {
const client = await connect(options);
event.reply('imap:listTree:from:reply', await client.listTree());
await client.logout();
}
async function listTreeTo (event, options) {
const client = await connect(options);
event.reply('imap:listTree:to:reply', await client.listTree());
await client.logout();
}
|