question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Output is not generated.

See original GitHub issue

Hi, I used the below snippet. Although it does not return any error but it does not produce any output. I think the code from line mailListener.on does not execute (Please help.!!! var MailListener = require(“mail-listener2”);

	 var mailListener = new MailListener({
	   username: "test@gmail.com",
	   password: "test",
	   host: "imap.gmail.com",
	   port: 993, // imap port
	   tls: true,
	   connTimeout: 10000, // Default by node-imap 
	   authTimeout: 5000, // Default by node-imap, 
	   debug: console.log, // Or your custom function with only one incoming argument. Default: null 
	   tlsOptions: { rejectUnauthorized: false },
	   mailbox: "INBOX", // mailbox to monitor 
	   searchFilter: ["UNSEEN", "FLAGGED"],
	   markSeen: true, // all fetched email willbe marked as seen and not fetched next time 
	   fetchUnreadOnStart: true, // use it only if you want to get all unread email on lib start. Default is `false` 
	   mailParserOptions: {streamAttachments: true}, // options to be passed to mailParser lib. 
	   attachments: true, // download attachments as they are encountered to the project directory 
	   attachmentOptions: { directory: "attachments/" }
	 });
	  
	 mailListener.start();
	 mailListener.on("server:connected", function(){
	   console.log("imapConnected");
	 });
	   
	 mailListener.on("mail:arrived", function(id){
	   console.log("new mail arrived with id:" + id);
	 });
	  
	 mailListener.on("mail:parsed", function(mail){
	   // do something with mail object including attachments 
	   console.log("emailParsed", mail.attachments);
	   // mail processing code goes here 
	 });

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

8reactions
rphansen91commented, Aug 23, 2017

@mchopra1004

Add an error handler to log any errors during setup

mailListener.on("error", function(err){ console.log(err); });

If “imapConnected” is logged on a successful connection my next issue was the searchFilter property. I had to remove the “FLAGGED” filter to see requests

0reactions
tombburnellcommented, Aug 11, 2020

I get the same as this…

If “FLAGGED” is set, then I see debug log that messages are arrived but the on(“mail”… handler does not fire.

If I remove FLAGGED, then the parsing is failing with mime.extension is not a function.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Output file is not generated after completing Run
Check the output options. If it's set to "create new sheet", it will fail. Try one of the Overwrite options instead.
Read more >
java - Output file not being created - Stack Overflow
I am trying to create an output.txt file, the code is compiling with no errors, but the o/p file is not being created....
Read more >
Output message not generated for Purchase order
When I create PO for other vendor (not 20001), the system is nicely generating the output of the PO for printout.
Read more >
Output for Invoice Not Created - SAP Forum
When the invoice is created (but not released to accounting) the output is not generated. I can create it manually before releasing it...
Read more >
Webpack - No Output File, No Errors Reported · Issue #1736
If the 'Output' directory (as specified in webpack.config.js) is not already present, its not created and the files are emitted (as reported ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found