erichrusch erichrusch - 4 years ago 131
Node.js Question

How to use node-imap and Meteor together?

I'm looking for a way to access an IMAP mail account like Gmail and using Meteor. I found node-imap but since it's an NPM module I've had a hard time getting NPM modules to work in Meteor.

Is there a good way to access an IMAP account using Meteor?

Answer Source

That's a fun one. I had exactly that as an example, see my repository for it on GitHub

In short: Follow this Coderwall tip to install the node-imap module. Then in your meteor code:

if (Meteor.isServer) {
  var require = __meteor_bootstrap__.require;
  var imap = require('imap');

and put the actual code in the

Meteor.startup(function() { ... }); 

call on the server side.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download