rubysherpas / r4ia

A place to file issues for Rails 4 in Action
2 stars 0 forks source link

How to set up Receiving a reply in production!! #12

Open eriol12 opened 9 years ago

eriol12 commented 9 years ago

The way I see it, there is many components to this. First as the author(s) mention in the book gmail is not a solid solution so some modifications are in order big time! Let's choose sendgrid. In the config/environments/production.rb let's add the proper settings:

config.action_mailer.delivery_method = :smtp
  host = '<your_heroku_app_name>.herokuapp.com'
  config.action_mailer.default_url_options = { host: host }
  ActionMailer::Base.smtp_settings = {
    :address        => 'smtp.sendgrid.net',
    :port           => '587',
    :authentication => :plain,
    :user_name      => ENV['SENDGRID_USERNAME'],
    :password       => ENV['SENDGRID_PASSWORD'],
    :domain         => 'heroku.com',
    :enable_starttls_auto => true
  }

Now let us say we use GoDaddy for the domain name my_domain_name.com, and we have setup email forwarding with catch all setting in place since when user replies to a comment (e.g. in the Notifier class reply_to: "Ticketee App <info+" +"#{@project.id}+#{@ticket.id}@my_domain_name.com>) that email address will not be existent! So according to my "calculations" all variants of the email info@my_domain_name.com will be forwarded to info@my_domain_name.com!

Now the issue is how is the class Receiver.parse(email) method going access the list of to addresses for the info@my_domain_name.com email, and get the first of them?!!!!!!!

Note: The text below is pure speculation on my part, since I have no clue how to make sense of it just like when Matthew McConaughey was chilling inside the blackhole in Interstellar!

So now we ought to actually have an email plan setup in GoDaddy to access the info@my_domain_name.com! And after somehow we setup username & password for info@my_domain_name.com somewhere in ticketee rails app and have Receiver class get the email feed, differentiate from multiple emails (God knows how!) and select the one needed to create the comment pertaining to ticket. And another thing i cannot understand! How does Receiver class handle emails when you can have multiple replies at exactly the same time from multiple users!

Therefore the authors need to further elaborate since this is a major and important part of understanding this edition of Rails 4 in Action!! Please author(s) shed light on this topic...

radar commented 9 years ago

We've actually removed this section from Rails 4 in Action as setting up a way to receive emails seemed to difficult to explain in the book. However, on investigation this morning it might be possible using the Mailgun code that we have already, as described here: https://devcenter.heroku.com/articles/mailgun.

This'll probably be supplementary material released after the book is done, rather than mentioned in the book itself.