Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Receiving email on Meteor?

Tags:

email

meteor

From the documentation (http://docs.meteor.com/#email), it seems sending email is fairly straight forward with Meteor. Just need to add the package, then specify the credentials of your 3rd party email provider in MAIL_URL.

Currently, I'm trying to develop the ability to receive emails. We need this facility to say unsubscribe a user from our system or allow users to input data by just replying to their email.

I just want to know, what is the best way to do this? Is it possible to receive and parse the emails from within my Meteor solution or do I need to set up something seperate solution to do this?

If it helps, I'm running a meteor website off an azure VM (in ubuntu) and our 3rd party provider is SendGrid.

like image 454
Diskdrive Avatar asked Dec 11 '13 23:12

Diskdrive


People also ask

What is Meteor API?

Meteor is a full-stack JavaScript platform for developing modern web and mobile applications. Meteor includes a key set of technologies for building connected-client reactive applications, a build tool, and a curated set of packages from the Node. js and general JavaScript community.


2 Answers

I'm also an Evangelist at SendGrid. Here is the procedure for receiving inbound email with our parse webhook in Meteor:

  1. Setup Meteorite a package manager for meteor. Installation procedure here: https://github.com/oortcloud/meteorite

  2. Run mrt add router in the command line.

  3. Next modify your javascript to add a route:

Meteor.Router.add({ '/inbound': function() {

post = this.request.body;

subject = post.subject;

body = post.body;

return [200, "Success"] } });

You can see a live example of receiving inbound email over here: http://hook.meteor.com and the source code for this is available here: https://github.com/kunal732/sgmeteor

Here is a blog post I wrote on the topic as well for more reference, http://sendgrid.com/blog/receive-inbound-email-meteorjs/

like image 73
kunal batra Avatar answered Oct 01 '22 20:10

kunal batra


You will first need to setup your machine (or another one) to actually be able to receive email. This in itself is a bit of a task and not super straightforward and will involve setting a MX record on your nameserver as well. It will require some reading. This might be a place to get started: https://help.ubuntu.com/12.04/installation-guide/i386/mail-setup.html

Once you have the ability to send email to the server you can use something like this to retrieve emails into node/meteor: https://github.com/mscdex/node-imap https://atmosphere.meteor.com/package/meteor-node-imap

If you'd rather have node.js itself run a smtp server to receive mail, you would probably want to look at something like this: https://npmjs.org/package/simplesmtp

like image 24
Christian Fritz Avatar answered Oct 01 '22 20:10

Christian Fritz