Rails 3 - Handle Incoming Messages (Allowing Users to reply to email notifications)

Hello,

Right now my app sends out email notifications. I'd like to allow the user to reply directly to the email, which then gets ingested by my app and inserted into the database.

Are there any Rails gems, services, tutorials that can point me in the right direction.

Also, probably need to make the reply-to email have a UID, replyto-- UID@domain.com, so I don't have to rely on the from (sender).

What do you think?

Thanks

Have you seen this: Action Mailer Basics — Ruby on Rails Guides

Thanks Brian. I have. That URL covers sending emails really well. But reeving, creating UUID in the reply address, and handling scalability on Heroku are topics it lacks. Given this is a real trendy thing to do these days, I was hoping to leverage someone's thoughts on the process.

Thoughts?

CuriousNewbie wrote in post #961680:

Thanks Brian. I have. That URL covers sending emails really well. But reeving,

Not possible with Rails alone AFAIK (at least not easily so).

creating UUID in the reply address,

The reply address is just a string. You can do all the usual string operations on it.

and handling scalability on Heroku are topics it lacks.

What about scalability?

Given this is a real trendy thing to do these days, I was hoping to leverage someone's thoughts on the process.

"Leverage" someone's thoughts? What?

Thoughts?

Well, you'll need Procmail or something to retrieve the mail and send it to your Rails app. Then you can have Rails take it from there...

Best,

Marnen Laibow-Koser wrote in post #961688:

CuriousNewbie wrote in post #961680:

Thanks Brian. I have. That URL covers sending emails really well. But reeving,

Not possible with Rails alone AFAIK (at least not easily so).

Or maybe it is now. Anyway, http://lmgtfy.com?q=rails+receive+email appears to yield lots of useful resources.

Best,

dear all, This may sound stupid, but I'm confused in creating the model relationship.

I set these 4 models:

ComUser < ActiveRecord::Base    belongs_to :DefKelamin    belongs_to :DefUserRole    belongs_to :DefJabatan Migration:     create_table :com_users do |t|     t.timestamps     t.references :def_jabatan, :null => false     t.integer :def_kelamin_id, :null => false     t.references :def_user_role, :null => false     t.column :username,'varchar(20)', :null => false     t.column :password,'varchar(20)', :null => false     end

DefJabatan < ActiveRecord::Base    has_one:ComUser Migration:     create_table :def_jabatans do |t|     t.timestamps     t.column :jabatan,'varchar(20)', :null => false     end

DefUserRole    has_one:ComUser Migration:     create_table :def_user_roles do |t|     t.timestamps     t.column :role,'varchar(20)', :null => false     t.string :description, :null => false     t.string :icon     end

DefKelamin < ActiveRecord::Base     has_one :ComUser Migration:     create_table :def_kelamins do |t|     t.timestamps     t.column :kelamin,'varchar(10)', :null => false     end

In the controller, I put a simple query:     @users = ComUser.find(:first)

and in the view, i simply put a object debug: <%=debug(@users)%>

and I get this:

--- !ruby/object:ComUser attributes:   def_jabatan_id: "1"   created_at: 2010-11-16 04:31:35   def_user_role_id: "1"   gsm: "-"   updated_at: 2010-11-16 04:31:35   alamat: "-"   username: admin   id: "1"   def_kelamin_id: "1"   password: admin   online_status: "2" attributes_cache: {} I'm getting a feeling that I didn't set the relationship right, because i don't see any attributes from the model started with Def-something that i create above.. Am I missing something here? I've been staying wake all night to sort this thing out, with no success. I even tries to alter the table by implicitly put a foreign key in the table for ComUser model using sql statements, and the debug result is still the same. How can i make this relationship work?

Thanks

Regards, Arga

arga aridarma wrote in post #961693:

dear all, This may sound stupid, but I'm confused in creating the model relationship.

[...]

Please don't hijack threads.

Best,

eh? what do you mean by hijack the threads?

Regards, Arga

He's suggesting that if you want to ask a new question, you create a new subject line and post a separate email. Keeps it easier for everyone to follow the content for a given topic.

FWIW, I'm not jumping in with an opinion on whether your request was relevant to the original thread or not - wasn't following it. Just describing what people usually mean when they say "hijacking threads" and aren't talking about some kind of weird concurrency bug :slight_smile:

Best Wishes, Peter

Ah, sorry. I wasn't aware that there is already a thread called "model relationship fails?" before. So, I will restart my question in the new email. Hopefully this time, it does not hijack another thread.

Thanks

regards, Arga

You misunderstood.

When you press “Reply” on a thread with a completely different subject (in your case “Rails 3 - Handle Incoming Messages (Allowing Users to reply to email notifications)”) and delete the text and subject to replace with your own, most e-mail clients will still consider your message part of the thread (since there are hidden headers that you haven’t gotten rid off). Next time just click “New Message”.

Best regards

Peter De Berdt