reply by email to comments
For starters, here's the resource we're working from:
http://railscasts.com/episodes/313-receiving-email-with-mailman?view=asciicast
https://github.com/blog/811-reply-to-comments-from-email has some great conventions. I like how reliable and simple github email replies are.
Recommend first step could be a simple method in the Comment model, like this:
def self.receive_mail(message)
node_id = message.subject[/^\# (\d+)$/, 1] # this grabs the node ID from the subject line
user_id = User.find_by(email: message.from.first)
if node_id.present? && user_id.present?
Comment.create! nid: node_id, body: message.body.decoded, uid: user_id
end
end
Then we need a mail script in the /script/ folder for something like the following:
#!/usr/bin/env ruby
require "rubygems"
require "bundler/setup"
require "mailman"
Mailman.config.pop3 = {
server: 'pop.gmail.com', port: 995, ssl: true,
username: ENV['GMAIL_USERNAME'],
password: ENV['GMAIL_PASSWORD']
}
Mailman::Application.run do
default do
begin
Comment.receive_mail(message)
rescue
Mailman.logger.error "Exception occurred while receiving message:\n#{message}"
Mailman.logger.error [e, *e.backtrace].join("\n")
end
end
end
Then we'll need to contact Sebastian to try to hook this up and we won't tell anyone about the feature just yet, but can try emailing a message with subject line: Replying to #6 from an email with a corresponding registered user on PublicLab.org, and see if it appends the new comment as we've laid out, on this post, which is nid=6: https://publiclab.org/notes/warren/12-7-2010/toy-spectrometers-arrived
I might have missed something, but let's see!
Seems like this is an important functionality to have in place before we announce to the lists that we have the capability to support conversation entirely through our website.
@jywarren So as you have stated above, GSoC 2017 has arrived and I could be working on this. I already created a feature branch for this and doing some experiments with mailman gem. And i'm checking for other solutions that could be used also. thanks.
Hi @jywarren @ebarry working on it!!
hi @ViditChitkara I guess its part of Email Integration project for this GSoC
Yes, it is!! I have some plans about this for the soc 2018 program!!!
Nice !!!.Actually, I have also planned to have my GSoC proposal on Email Integration Project.
Cool!
Sounds great -- there's plenty to do, so anything we can accomplish now we can build on, refine further for SoC for sure! Thanks!
On Wed, Feb 14, 2018 at 5:37 AM, Vidit [email protected] wrote:
Cool!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/214#issuecomment-365563045, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJweeuP1qvxLhzynG_TeUHFlhLOLDks5tUrdsgaJpZM4DjoxY .
This is now working! Checklist for remaining parts might be:
- [x] change sending email from
do-not-reply@tonotifications@ - [x] ensure it doesn't include the reply email content (there can be a lot) below the
... - [ ] Extend feature to Answer comment also. Anything else to break out here @namangupta01 ?
yes we can also figure out if we can somehow write a test for it without using email services like mail file and we can also make function test for receive_mail.
Parsing email content depends upon the mail service we are using to do emails.
On Wed, Jun 27, 2018 at 5:00 AM Jeffrey Warren [email protected] wrote:
This is now working! Checklist for remaining parts might be:
- change sending email from do-not-reply@ to notifications@
- ensure it doesn't include the reply email content (there can be a lot) below the ...
Anything else to break out here @namangupta01 https://github.com/namangupta01 ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/214#issuecomment-400494902, or mute the thread https://github.com/notifications/unsubscribe-auth/ATwCYdQRpw-BdNaVY5q7_6gAT12Y2VEhks5uAsQPgaJpZM4DjoxY .
This is github's testing reply parsing
From: Naman Gupta [email protected] Sent: Wednesday, June 27, 2018 7:05:11 PM To: publiclab/plots2 Cc: railsprojects2018; Manual Subject: Re: [publiclab/plots2] reply by email to comments (#214)
Parsing email content depends upon the mail service we are using to do emails.
On Wed, Jun 27, 2018 at 5:00 AM Jeffrey Warren [email protected] wrote:
This is now working! Checklist for remaining parts might be:
- change sending email from do-not-reply@ to notifications@
- ensure it doesn't include the reply email content (there can be a lot) below the ...
Anything else to break out here @namangupta01 https://github.com/namangupta01 ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/214#issuecomment-400494902, or mute the thread https://github.com/notifications/unsubscribe-auth/ATwCYdQRpw-BdNaVY5q7_6gAT12Y2VEhks5uAsQPgaJpZM4DjoxY .
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/publiclab/plots2/issues/214#issuecomment-400673514, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AmwIh0SuZQWP4SXxXqEC7w74iaVhYcatks5uA4oPgaJpZM4DjoxY.
@jywarren Above message is send using outlook email id. This message was not parsed correctly. Maybe github is also parsing gmail messages?
Above is send by outlook.
On Wed, Jun 27, 2018 at 7:06 PM railsprojects2018 [email protected] wrote:
This is github's testing reply parsing
From: Naman Gupta [email protected] Sent: Wednesday, June 27, 2018 7:05:11 PM To: publiclab/plots2 Cc: railsprojects2018; Manual Subject: Re: [publiclab/plots2] reply by email to comments (#214)
Parsing email content depends upon the mail service we are using to do emails.
On Wed, Jun 27, 2018 at 5:00 AM Jeffrey Warren [email protected] wrote:
This is now working! Checklist for remaining parts might be:
- change sending email from do-not-reply@ to notifications@
- ensure it doesn't include the reply email content (there can be a lot) below the ...
Anything else to break out here @namangupta01 https://github.com/namangupta01 ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/214#issuecomment-400494902, or mute the thread < https://github.com/notifications/unsubscribe-auth/ATwCYdQRpw-BdNaVY5q7_6gAT12Y2VEhks5uAsQPgaJpZM4DjoxY
.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub< https://github.com/publiclab/plots2/issues/214#issuecomment-400673514>, or mute the thread< https://github.com/notifications/unsubscribe-auth/AmwIh0SuZQWP4SXxXqEC7w74iaVhYcatks5uA4oPgaJpZM4DjoxY
.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/214#issuecomment-400673841, or mute the thread https://github.com/notifications/unsubscribe-auth/ATwCYaCQh1gdATz5UQeJlxFI4FXj3G4tks5uA4pFgaJpZM4DjoxY .
This is send via yahooo On Wednesday, June 27, 2018, 7:28:02 PM GMT+5:30, Naman Gupta [email protected] wrote:
This is send by outlook.
On Wed, Jun 27, 2018 at 7:06 PM railsprojects2018 [email protected] wrote:
This is github's testing reply parsing
From: Naman Gupta [email protected] Sent: Wednesday, June 27, 2018 7:05:11 PM To: publiclab/plots2 Cc: railsprojects2018; Manual Subject: Re: [publiclab/plots2] reply by email to comments (#214)
Parsing email content depends upon the mail service we are using to do emails.
On Wed, Jun 27, 2018 at 5:00 AM Jeffrey Warren [email protected] wrote:
This is now working! Checklist for remaining parts might be:
- change sending email from do-not-reply@ to notifications@
- ensure it doesn't include the reply email content (there can be a lot) below the ...
Anything else to break out here @namangupta01 https://github.com/namangupta01 ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/214#issuecomment-400494902, or mute the thread < https://github.com/notifications/unsubscribe-auth/ATwCYdQRpw-BdNaVY5q7_6gAT12Y2VEhks5uAsQPgaJpZM4DjoxY
.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub< https://github.com/publiclab/plots2/issues/214#issuecomment-400673514>, or mute the thread< https://github.com/notifications/unsubscribe-auth/AmwIh0SuZQWP4SXxXqEC7w74iaVhYcatks5uA4oPgaJpZM4DjoxY
.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/214#issuecomment-400673841, or mute the thread https://github.com/notifications/unsubscribe-auth/ATwCYaCQh1gdATz5UQeJlxFI4FXj3G4tks5uA4pFgaJpZM4DjoxY .
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Above message is sent via yahoo. So the conclusion is that github only able to parse mails from gmail not other mails this may be because they are not able to trim emails from other services using any sphefic class or something like we were able to do in gmail using gmail_quote class.
I think we can also able to do parsing from yahoo by using somewhat class like yahoo_quoted but other email services provide no such points to differentiate.
Perhaps there are examples of email quoting from various services that people have collected as a set of test strings? Or we could do the same?
Also I like how the excess is hidden behind ...!
Yes @jywarren i didn't find any collection but i am already collecting.
@jywarren Which of the email services should i collect? gmail, yahoo, hotmail, outlook any more?