Email notification & reply by email

Hi ,
I would like to implement a forum where I need to implement email notifications for a discussion and reply by using inbound email .
Could you please point me to an example which uses the meteor way ? I was not able to find good meteor examples .

regards
Mahesh

1 Like

I’m thinking this is a larger project for there to be adequate examples.

Assuming you’ve got the forum stuff down (you will most likely find examples on how to create blogs with Meteor. If you can create a blog, a forum is a step above that), you could use Meteor’s Email.send API to do exactly this.

When a user posts to the forum, you can do something like this:

//this is somewhat pseudo code, exact API can be found in Docs.
//in post topic method
let thread = Threads.findOne(threadIs);
Threads.insert({_id: threadId, post: thePost});
this.unblock(); // yield fiber
thread.followers.forEach(function(follower){
  let fromAddress = "yourServersSpecialEmailAddress@example.com"
  Email.send(follower.emailAddress) //or you can probably batch send???
})

But how do you make it so that replying to an email will post on the thread? If your mail server has some sort of notification API, you can use that to send notifications to your Meteor server using a server-side router like meteorhacks:picker.

//pseudo-ish code.
Picker.route('/your/email/notification/endpoint', function(params,req,...){
  let thread = Threads.findOne(params.id);
  Threads.post({_id:params.id,post: params.post});
  thread.followers.forEach(...) //same as above, send email to each follower.
})