mail-listener2 doesn't work

前端 未结 2 1604
自闭症患者
自闭症患者 2021-01-12 05:02

This is my code for the mail-listener file.

I call the startListening function in my main file, and I can read \"Imap connected\" in the console , but then, even if

2条回答
  •  星月不相逢
    2021-01-12 05:51

    I had the same issue. The example doesn't work. I'm using mail-notifier instead:

    var notifier = require('mail-notifier');
    
    var imap = {
          user: "_example@example.com_",
          password: "password",
          host: "imap.gmail.com",
          port: 993,
          tls: true,
          tlsOptions: { rejectUnauthorized: false }
    };
    
    notifier(imap).on('mail',function(mail){
             console.log("GOT MAIL");
    }).start();
    

    Works like a charm

提交回复
热议问题