Giter Site home page Giter Site logo

node-imapnotify's People

Contributors

a-sk avatar askurihin avatar mmathis avatar renatofdds avatar rlue avatar seanfarley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

node-imapnotify's Issues

Cannot get systemd service to work with config.js and encrypted password

Hello again,

imapnotify has been working very well for me when manually starting it from the command line as. However, I've been struggling to get the bundled systemd service working (from the Arch AUR package). I edited the file at /usr/lib/systemd/system/[email protected] as follows:

/usr/lib/systemd/system$ diff -aur [email protected]{.orig,}
--- [email protected]    2015-09-29 22:18:10.000000000 +1000
+++ [email protected] 2015-10-06 15:30:10.831899633 +1100
@@ -3,9 +3,9 @@
 After=network.target

 [Service]
-User=username
+User=protist
 Type=simple
-ExecStart=/usr/bin/imapnotify -c ~/.config/imap_inotify/%I.json
+ExecStart=/usr/bin/imapnotify -c /home/protist/.config/imapnotify/%I.js
 Restart=on-failure
 RestartSec=20

After running sudo systemctl start imapnotify@accountA, the service starts fine. However, I get Authentication failed errors. I have stores the password in the python-accessible gnome keyring, as per suggestions in the Arch wiki for offlineimap. Hence, there is the following line in /home/protist/.config/imapnotify/accountA.js.

exports.password = getStdout('python2 -c \'import keyring; print keyring.get_password("imapnotify","[email protected]")\'');

This works fine when launching imapnotify from the command line. When it fails from systemd, I wondered if perhaps the sudo process didn't have the correct environment variables. I tried making the systemd service a user service. (IMO if this worked it would be the "proper" way to do it.) I copied the service file to /usr/lib/systemd/user/[email protected] and removed the line with User=username. I then ran systemctl --user start imapnotify@accountA. This time, it failed with

[email protected]: Failed at step GROUP spawning /usr/bin/imapnotify: Operation not permitted

Is there a way to use encrypted passwords with the systemd service?

pass_eval is not working with pass

Hi,

I switched from python-imapnotify to your node-imapnotify as the one on python is not working.

Only one (important) thing for me is that I am unable to make it work with pass.

"password_eval": "/usr/bin/pass servers/email",

is failling for me :

{"name":"imap_inotify","hostname":"x","pid":27719,"level":50,"box":"INBOX","msg":"Error registered","time":"2017-10-30T12:31:52.486Z","v":0}
{"name":"imap_inotify","hostname":"x","pid":27719,"level":50,"box":"INBOX","msg":"{ Error: No supported authentication method(s) available. Unable to login.\n    at Connection.<anonymous> (/usr/lib/node_modules/imapnotify/node_modules/imap/lib/Connection.js:1679:15)\n    at Connection._resTagged (/usr/lib/node_modules/imapnotify/node_modules/imap/lib/Connection.js:1535:22)\n    at Parser.<anonymous> (/usr/lib/node_modules/imapnotify/node_modules/imap/lib/Connection.js:194:10)\n    at emitOne (events.js:96:13)\n    at Parser.emit (events.js:191:7)\n    at Parser._resTagged (/usr/lib/node_modules/imapnotify/node_modules/imap/lib/Parser.js:175:10)\n    at Parser._parse (/usr/lib/node_modules/imapnotify/node_modules/imap/lib/Parser.js:139:16)\n    at Parser._tryread (/usr/lib/node_modules/imapnotify/node_modules/imap/lib/Parser.js:82:15)\n    at TLSSocket.Parser._cbReadable (/usr/lib/node_modules/imapnotify/node_modules/imap/lib/Parser.js:53:12)\n    at emitNone (events.js:86:13) source: 'authentication' }","time":"2017-10-30T12:31:52.487Z","v":0}

I am missing a proper format to use it ?
It is like the parsing of the command is failling.

Many thanks!

installing process & configuration

Hello,

my question might be completely stupid but I have installed npm and node from git which leads to these versions :

➔ node -v    
v7.0.0-pre

~ 
➔ npm -v
3.10.5

then I installed the package using the command

npm install -g imapnotify

and finally tried to use the command using this (I obfuscated my machine name on purpose)

~ 
➔ imapnotify -c test.js
{"name":"imap_inotify","hostname":"**********","pid":5206,"level":50,"msg":"Parsing error: config file must be in JSON format","time":"2016-07-07T15:35:40.623Z","v":0}

test.js is formatted like that

var child_process = require('child_process');

function getStdout(cmd) {
    var stdout = child_process.execSync(cmd);
    return stdout.toString().trim();
}

exports.host = "imap.gmail.com";
exports.port = 993;
exports.tls = true;
exports.tlsOptions = { "rejectUnauthorized": false };
exports.username = "******@gmail.com";
exports.password = getStdout("python3 ~/.get_passwd.py 'imap.gmail.com' '*******@gmail.com'");
exports.onNewMail = "/usr/bin/mbsync -a";
exports.onNewMailPost = "echo 'new mail in %s' > ~/tmp.yahoo";
exports.boxes = [ "INBOX" ];

so nothing really different from the proposed configuration file. Do you have an idea in which direction should I watch to find what is going wrong ?

Thanks a lot

"Error: self signed certificate" prevents launch

Trying to run with this config.js:

 var child_process = require('child_process');

    function getStdout(cmd) {
        var stdout = child_process.execSync(cmd);
        return stdout.toString().trim();
    }

    exports.host = "imap.gmail.com";
    exports.port = 993;
    exports.tls = true;
    exports.tlsOptions = { "rejectUnauthorized": true };
    exports.username = "[email protected]";
    exports.password = getStdout("/usr/local/bin/gpgpasswordscript.sh");
    exports.onNotify = "systemctl --user start update-mail-%s.service";
    exports.boxes = [ "INBOX", "Other" ];

throws this error:

{"name":"imap_inotify","hostname":"myhostname","pid":1453,"level":50,"box":"Other","msg":"Error registered","time":"2018-09-25T12:37:53.167Z","v":0} [20/557]
{"name":"imap_inotify","hostname":"myhostname","pid":1453,"level":50,"box":"Other","msg":"{ Error: self signed certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1049:34)
    at TLSSocket.emit (events.js:182:13)
    at TLSSocket._finishInit (_tls_wrap.js:631:8)
    at Socket.ondata (internal/wrap_js_stream.js:63:22)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) code: 'DEPTH_ZERO_SELF_SIGNED_CERT', source: 'socket' }","time":"2018-09-25T12:37:53.170Z","v":0}
{"name":"imap_inotify","hostname":"myhostname","pid":1453,"level":30,"box":"Other","msg":"Restarting immediately","time":"2018-09-25T12:37:53.170Z","v":0}
{"name":"imap_inotify","hostname":"myhostname","pid":1453,"level":50,"box":"INBOX","msg":"Error registered","time":"2018-09-25T12:37:53.176Z","v":0}
{"name":"imap_inotify","hostname":"myhostname","pid":1453,"level":50,"box":"INBOX","msg":"{ Error: self signed certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1049:34)
    at TLSSocket.emit (events.js:182:13)
    at TLSSocket._finishInit (_tls_wrap.js:631:8)
    at Socket.ondata (internal/wrap_js_stream.js:63:22)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) code: 'DEPTH_ZERO_SELF_SIGNED_CERT', source: 'socket' }","time":"2018-09-25T12:37:53.176Z","v":0}
{"name":"imap_inotify","hostname":"myhostname","pid":1453,"level":30,"box":"INBOX","msg":"Restarting immediately","time":"2018-09-25T12:37:53.177Z","v":0}
{"name":"imap_inotify","hostname":"myhostname","pid":1453,"level":50,"box":"Other","msg":"Error registered","time":"2018-09-25T12:37:53.313Z","v":0}
{"name":"imap_inotify","hostname":"myhostname","pid":1453,"level":50,"box":"Other","msg":"{ Error: self signed certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1049:34)
    at TLSSocket.emit (events.js:182:13)
    at TLSSocket._finishInit (_tls_wrap.js:631:8)
    at Socket.ondata (internal/wrap_js_stream.js:63:22)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) code: 'DEPTH_ZERO_SELF_SIGNED_CERT', source: 'socket' }","time":"2018-09-25T12:37:53.314Z","v":0}
{"name":"imap_inotify","hostname":"myhostname","pid":1453,"level":30,"box":"Other","msg":"Scheduling restart in 3000","time":"2018-09-25T12:37:53.314Z","v":0
}
{"name":"imap_inotify","hostname":"myhostname","pid":1453,"level":50,"box":"INBOX","msg":"Error registered","time":"2018-09-25T12:37:53.315Z","v":0}
{"name":"imap_inotify","hostname":"myhostname","pid":1453,"level":50,"box":"INBOX","msg":"{ Error: self signed certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1049:34)
    at TLSSocket.emit (events.js:182:13)
    at TLSSocket._finishInit (_tls_wrap.js:631:8)
    at Socket.ondata (internal/wrap_js_stream.js:63:22)
    at Socket.emit (events.js:182:13)\n    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) code: 'DEPTH_ZERO_SELF_SIGNED_CERT', source: 'socket' }","time":"2018-09-25T12:37:53.316Z","v":0}
{"name":"imap_inotify","hostname":"myhostname","pid":1453,"level":30,"box":"INBOX","msg":"Scheduling restart in 3000","time":"2018-09-25T12:37:53.316Z","v":0
}
{"name":"imap_inotify","hostname":"myhostname","pid":1453,"level":50,"box":"Other","msg":"Error registered","time":"2018-09-25T12:37:56.457Z","v":0}
{"name":"imap_inotify","hostname":"trauerschwan","pid":1453,"level":50,"box":"Alert","msg":"{ Error: self signed certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1049:34)
    at TLSSocket.emit (events.js:182:13)
    at TLSSocket._finishInit (_tls_wrap.js:631:8)
    at Socket.ondata (internal/wrap_js_stream.js:63:22)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) code: 'DEPTH_ZERO_SELF_SIGNED_CERT', source: 'socket' }","time":"2018-09-25T12:37:56.458Z","v":0}
{"name":"imap_inotify","hostname":"trauerschwan","pid":1453,"level":30,"box":"Other","msg":"Scheduling restart in 6000","time":"2018-09-25T12:37:56.458Z","v":0
}
{"name":"imap_inotify","hostname":"myhostname","pid":1453,"level":50,"box":"INBOX","msg":"Error registered","time":"2018-09-25T12:37:56.494Z","v":0}
{"name":"imap_inotify","hostname":"myhostname","pid":1453,"level":50,"box":"INBOX","msg":"{ Error: self signed certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1049:34)
    at TLSSocket.emit (events.js:182:13)
    at TLSSocket._finishInit (_tls_wrap.js:631:8)
    at Socket.ondata (internal/wrap_js_stream.js:63:22)
    at Socket.emit (events.js:182:13)\n    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) code: 'DEPTH_ZERO_SELF_SIGNED_CERT', source: 'socket' }","time":"2018-09-25T12:37:56.495Z","v":0}
{"name":"imap_inotify","hostname":"trauerschwan","pid":1453,"level":30,"box":"INBOX","msg":"Scheduling restart in 6000","time":"2018-09-25T12:37:56.495Z","v":0
}{"name":"imap_inotify","hostname":"trauerschwan","pid":1453,"level":50,"box":"Other","msg":"Error registered","time":"2018-09-25T12:38:02.598Z","v":0}
{"name":"imap_inotify","hostname":"trauerschwan","pid":1453,"level":50,"box":"Other","msg":"{ Error: self signed certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1049:34)
    at TLSSocket.emit (events.js:182:13)
    at TLSSocket._finishInit (_tls_wrap.js:631:8)
    at Socket.ondata (internal/wrap_js_stream.js:63:22)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) code: 'DEPTH_ZERO_SELF_SIGNED_CERT', source: 'socket' }","time":"2018-09-25T12:38:02.599Z","v":0}
/usr/lib/node_modules/imapnotify/bin/imapnotify:93
        throw Error('Max retry limit reached')
        ^

Error: Max retry limit reached
    at Connection.<anonymous> (/usr/lib/node_modules/imapnotify/bin/imapnotify:93:15)
    at Object.onceWrapper (events.js:273:13)
    at Connection.emit (events.js:182:13)
    at TLSSocket._onError (/usr/lib/node_modules/imapnotify/node_modules/imap/lib/Connection.js:151:10)
    at TLSSocket.emit (events.js:182:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)

On an ArchLinux machine with the following specs:
imapnotify v0.4.1-9 (from ArchLinux AUR)
node v10.11.0
npm v6.4.1

Lower timeout value after resuming from suspend

I've noticed that when I resume from suspend, imapnotify takes a variable amount of time to connect. Sometimes it's less than a minute. However, today it took 15 minutes. I was wondering if it would be possible to reduce the timeout value? Here are some potentially relevant entries from systemd. (I resumed from suspend at 13:07:21)

$ systemctl status --user [email protected]
May 06 13:21:20 protist-XPS-17 imapnotify[628]: {"name":"imap_inotify","hostname":"protist-XPS-17","pid":628,"level":50,"box":"INBOX","msg":"Error registered","time":"2016-05-06T03:21:20.433Z","v":0}
May 06 13:21:20 protist-XPS-17 imapnotify[628]: {"name":"imap_inotify","hostname":"protist-XPS-17","pid":628,"level":50,"box":"INBOX","msg":"{ Error: read ETIMEDOUT\n    at exports._errnoException (util.js:896:11)\n   
May 06 13:21:20 protist-XPS-17 imapnotify[628]: {"name":"imap_inotify","hostname":"protist-XPS-17","pid":628,"level":30,"box":"INBOX","msg":"Restarting immediately","time":"2016-05-06T03:21:20.433Z","v":0}
May 06 13:21:21 protist-XPS-17 imapnotify[628]: {"name":"imap_inotify","hostname":"protist-XPS-17","pid":628,"level":30,"box":"INBOX","msg":"Connected to server","time":"2016-05-06T03:21:21.033Z","v":0}
May 06 13:21:21 protist-XPS-17 imapnotify[628]: {"name":"imap_inotify","hostname":"protist-XPS-17","pid":628,"level":30,"box":"INBOX","msg":"Selecting box","time":"2016-05-06T03:21:21.033Z","v":0}

Several accounts possible?

Hello,

First thank you for this great tool. I'd like to know, do you provide a way to have multiple accounts, or should I run several instances on several configuration files?

Thanks.

Add STARTTLS

Hello,

First, thanks for this great module. However, it seems that STARTTLS is not supported out of the box, while it should be pretty easy to configure it, as it's just a new parameter to give to Imap(...) which is autotls that should be equal to always when the user wants to enable STARTTLS (default: never). Would it be possible to do this simple change?

Thanks!

ECONNRESET every 30s more or less

Hello,

I'm getting this error every 30s.

Error: read ECONNRESET\n at exports._errnoException (util.js:1018:11)\n at TCP.onread (net.js:572:26)\n code: 'ECONNRESET',\n errno: 'ECONNRESET',\n syscall: 'read',\n source: 'socket' }","time":"2017-07-22T11:02:13.602Z","v":0}

Any clues on what might be causing this? I'm connecting to a Exchange server trough IMAP.

Post Command Not Fired

On line 243, the last argument of the ?: construct is command when it should be postCommand. This means the on notify command is fired twice, but the post command never.

Crash on empty config entry

I just installed this, and created a JSON config file as mentioned in the README.

As I had no need for an 'onNotifyPost' entry, I initially left it empty:
exports.onNotifyPost = "";

That crashed with:

/usr/lib/node_modules/imapnotify/node_modules/printf/lib/printf.js:31
content = str.slice(lastIndex);
               ^
TypeError: Cannot read property 'slice' of undefined
at tokenize (/usr/lib/node_modules/imapnotify/node_modules/printf/lib/printf.js:31:16)
at new Formatter (/usr/lib/node_modules/imapnotify/node_modules/printf/lib/printf.js:41:18)
at module.exports (/usr/lib/node_modules/imapnotify/node_modules/printf/lib/printf.js:459:19)
at notify (/usr/lib/node_modules/imapnotify/bin/imapnotify:241:21)
at Connection.<anonymous> (/usr/lib/node_modules/imapnotify/bin/imapnotify:66:11)
at emitOne (events.js:96:13)
at Connection.emit (events.js:191:7)
at Connection._resUntagged (/usr/lib/node_modules/imapnotify/node_modules/imap/lib/Connection.js:1287:14)
at Parser.<anonymous> (/usr/lib/node_modules/imapnotify/node_modules/imap/lib/Connection.js:191:10)
at emitOne (events.js:96:13)`

The same happened if I simply commented that line out of the config.

I've currently fixed it simply by putting /usr/bin/true in the onNotifyPost export, but this should probably be handled!

%s substitution without formatting for onNotify

Currently, imapnotify substitutes %s in onNotify by a formatted mailbox name, i.e., the mailbox name is converted to lowercase and / is replaced by -. It would be great if imapnotify would support putting the mailbox name directly (without any reformatting; e.g., via %S) so that it can be used by the onNotify script to sync just that folder. Right now, this does not work for me because folder names are case sensitive and / needs to be kept.

Dependency Failure: Bunyan > dtrace-provider (Mac OS X)

When installing on Mac OS (10.11 El Capitan), I get the following error:

> [email protected] install /Users/rlue/.nvm/versions/node/v7.9.0/lib/node_modules/imapnotify/node_modules/dtrace-provider
> node scripts/install.js

---------------
Building dtrace-provider failed with exit code 1 and signal 0
re-run install with environment variable V set to see the build output
---------------
/usr/local/lib
└─┬ [email protected]
  ├─┬ [email protected]
  │ ├─┬ [email protected]
...

The latest version of bunyan (1.8.10) uses a later version of dtrace-provider (0.8.1), which does not throw this error. Seeing as how it's a minor version bump, is there any chance this dependency could be updated?

arch linux crashes on new mail

hi there,

I use the arch linux package and it connects to my server, but it crashes on new email

[martin@martin-arch org-mode]$ imapnotify 
{"name":"imap_inotify","hostname":"martin-arch","pid":26012,"level":30,"box":"INBOX","msg":"Connected to server","time":"2017-06-13T20:47:48.210Z","v":0}
{"name":"imap_inotify","hostname":"martin-arch","pid":26012,"level":30,"box":"INBOX","msg":"Selecting box","time":"2017-06-13T20:47:48.212Z","v":0}
{"name":"imap_inotify","hostname":"martin-arch","pid":26012,"level":30,"box":"INBOX","msg":"New mail","time":"2017-06-13T20:48:23.436Z","v":0}
/usr/lib/node_modules/imapnotify/node_modules/printf/lib/printf.js:31
  content = str.slice(lastIndex);
               ^

TypeError: Cannot read property 'slice' of undefined
    at tokenize (/usr/lib/node_modules/imapnotify/node_modules/printf/lib/printf.js:31:16)
    at new Formatter (/usr/lib/node_modules/imapnotify/node_modules/printf/lib/printf.js:41:18)
    at module.exports (/usr/lib/node_modules/imapnotify/node_modules/printf/lib/printf.js:459:19)
    at notify (/usr/lib/node_modules/imapnotify/bin/imapnotify:235:17)
    at Connection.<anonymous> (/usr/lib/node_modules/imapnotify/bin/imapnotify:65:9)
    at emitOne (events.js:115:13)
    at Connection.emit (events.js:210:7)
    at Connection._resUntagged (/usr/lib/node_modules/imapnotify/node_modules/imap/lib/Connection.js:1287:14)
    at Parser.<anonymous> (/usr/lib/node_modules/imapnotify/node_modules/imap/lib/Connection.js:191:10)
    at emitOne (events.js:115:13)

Feel free to ask for more information. The server is a https://github.com/mail-in-a-box/mailinabox

imapnotify connecting but not triggering notifications

Hi, I've been using the latest version of imapnotify for a while now, installed from the AUR (0.1.0-6). However, it seems to have stopped working in the last few days. It appears to connect fine, but doesn't notify on new emails. I'm using the systemd service.

$ systemctl status --user [email protected][email protected] - Execute scripts on new messages using IDLE imap command
   Loaded: loaded (/usr/lib/systemd/user/[email protected]; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2016-07-16 11:29:26 AEST; 5min ago
 Main PID: 11945 (node)
   CGroup: /user.slice/user-1000.slice/[email protected]/imapnotify.slice/[email protected]
           └─11945 node /usr/bin/imapnotify -c /home/protist/.config/imapnotify/main.js

Jul 16 11:29:26 protist-XPS-17 systemd[596]: Started Execute scripts on new messages using IDLE imap command.
Jul 16 11:29:27 protist-XPS-17 imapnotify[11945]: {"name":"imap_inotify","hostname":"protist-XPS-17","pid":11945,"level":30,"box":"INBOX","msg":"Connected to server","time":"2016-07-16T01:29:27.026Z","v":0}
Jul 16 11:29:27 protist-XPS-17 imapnotify[11945]: {"name":"imap_inotify","hostname":"protist-XPS-17","pid":11945,"level":30,"box":"INBOX","msg":"Selecting box","time":"2016-07-16T01:29:27.028Z","v":0}

After a new email arrives on the server, nothing happens, and nothing changes in the status output.

OTOH, IMAP IDLE on my Android phone's K-9 app appears to be working fine with the same account. Is there a way to troubleshoot imapnotify further?

oauth support

recently, gmail change the authentication to oauth2. Does imapnotify support oauth2 authentication?

NPM repo not up-to-date

Per issue #11, is there any chance we could get v0.3.0 pushed to npm?

(Or update the README installation instructions to use npm install -g a-sk/node-imapnotify instead?)

Parsing error: config file must be in JSON format

I can't seem to get node-imapnotify to work. I've installed nodejs-imapnotify-git on Arch from the AUR, then copied the node-module config file from the "myconfig.js" example. I changed text between <> and ~/getpass.sh. However, I get the following error when trying to run it.

$ imapnotify -c ~/.config/imapnotify.js 
{"name":"imap_inotify","hostname":"protist-XPS-17","pid":30266,"level":50,"msg":"Parsing error: config file must be in JSON format","time":"2015-09-30T00:35:02.425Z","v":0}

Proposed PR: trigger script on delete/update events

First of all, just want to say thank you for a very handy utility.

I wanted mbsync to run not just when I received new mail, but also whenever messages were deleted from the server, or marked as read (in case, for example, I delete them from my phone). For that reason, I added event listeners for node-imap's 'expunge' and 'update' events. (It's not very pretty, I know – JS is not my main language.)

But since that functionality goes beyond the stated purpose of imapnotify ('Execute scripts on new messages using IDLE IMAP command'), I thought it would make more sense to hold off on a PR, and ask if there would be interest in merging this feature first.

Are there any use cases where users would want to trigger their scripts only on new mail, and not on deletions or other changes to the mailbox?

imapnotify only reports new mail for 5 minutes

Hello again. Unfortunately, issue #5 wasn't entirely resolved. After connecting okay, I only receive notifications for 5 minutes. I then receive no notifications, and then later (fairly consistently, at just over 21 minutes after the initial connection) imapnotify detects an error (Error registered) and restarts. Hence, for 16 of 21 minutes, imapnotify isn't working.

I initially worked out how long it takes to timeout by scheduling an email to myself every three minutes. While testing, I feared that I'd perturb the system by "refreshing" the connection from the server's end every three minutes. Despite this, the connection still failed rapidly. I also repeated this experiment with a two minute loop. Finally, I waited just under five minutes, then sent a flurry of emails. Imapnotify is timing out fairly precisely at 5 minutes, I'd say 4:46–5:02.

I ran DEBUG=1 /usr/bin/imapnotify -c ~/.config/imapnotify/main.js, but there was no output related to the timeout.

I also wondered if sending NOOP would be a fix, but it seems like ~5 minutes is too low for a IMAP server to time me out?

I know that you don't use imapnotify yourself any more, and I appreciate your troubleshooting on previous issues, so please let me know if you didn't want to sort this bug out. (But I'd love it if you did, of course!)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.