DNRN
DNRN

Reputation: 2489

How to handle email received event

I have created a simple forum application in node.js, where it is possible for a member to to subscribe to a topic, and receive an email when a new post is posted.

Now it could be really cool if the subscribe could just reply to the email and thereby reply to the post. For this to work, I need some way to handle the email received event, and know who replied (from) and to which topic (could be a generic too). And call a service in my backend.

I have a gmail account, is this possible to setup in gmail?

Is there another service where this is possible to like Mailgun?

I am not looking for a complete solution, more a push in the right direction.

Upvotes: 1

Views: 224

Answers (1)

Boris Siscanu
Boris Siscanu

Reputation: 1009

We tried once to implement Gmail API and to be honest it was a lot of frustration. Eventually we decided to use node-gmail-api package (many thanks to Nathan)

// Fetch latest 10 emails and show the snippet

var Gmail = require('node-gmail-api')
  , gmail = new Gmail(<KEY>)
  , s = gmail.messages('label:inbox', {max: 10})

s.on('data', function (d) {
  console.log(d.snippet)
})

Upvotes: 1

Related Questions