How do I use 'reply-to' with Action Mailer

Hey there folks, I’m sure there is a stupidly easy answer for this, but
I can’t seem to find it. I’m building a site and I want a way for one
user to contact another. Simple enough. The problem lies in the fact I
want the email to ‘come from’ the user, and not from my system.

In my ActionMailer class if I do the following:
@from = “#{from_user.display_name} [email protected]

it works just fine. But I really want is:
@from = “#{from_user.display_name} [email protected]

If I do that though, the email never gets delivered.

So I guess my question is can someone tell me how to make this work
correctly? Of if I can’t get this to work, is there a way to set a
‘reply-to’ address so that when the user clicks reply in their email it
goes to ‘[email protected]’ and not to my notifier address?

Thanks in advance for the help.

Hi Mark

You should be able to send the email using the second option you
described. Probably, the email server you’re using is setup to only send
emails from your domain, check the server logs to see why the email is
not delivered.

You can set the reply-to header like this:
@headers[‘Reply-to’] = from_user.reply_address

Cheers,

Cloves Carneiro Jr
http://www.ccjr.name

Mark B. wrote:

Hey there folks, I’m sure there is a stupidly easy answer for this, but
I can’t seem to find it. I’m building a site and I want a way for one
user to contact another. Simple enough. The problem lies in the fact I
want the email to ‘come from’ the user, and not from my system.

In my ActionMailer class if I do the following:
@from = “#{from_user.display_name} [email protected]

it works just fine. But I really want is:
@from = “#{from_user.display_name} [email protected]

If I do that though, the email never gets delivered.

So I guess my question is can someone tell me how to make this work
correctly? Of if I can’t get this to work, is there a way to set a
‘reply-to’ address so that when the user clicks reply in their email it
goes to ‘[email protected]’ and not to my notifier address?

Thanks in advance for the help.

Thanks Cloves. That was exactly what I was looking for.
-Mark

Cloves Carneiro Jr wrote:

Hi Mark

You should be able to send the email using the second option you
described. Probably, the email server you’re using is setup to only send
emails from your domain, check the server logs to see why the email is
not delivered.

You can set the reply-to header like this:
@headers[‘Reply-to’] = from_user.reply_address

Cheers,

Cloves Carneiro Jr
http://www.ccjr.name