Forum: Ruby on Rails How do I use 'reply-to' with Action Mailer

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mark B. (Guest)
on 2006-03-17 22:02
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} <removed_email_address@domain.invalid>"

it works just fine. But I really want is:
@from = "#{from_user.display_name} <removed_email_address@domain.invalid>"

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 'removed_email_address@domain.invalid' and not to my notifier address?

Thanks in advance for the help.
Cloves Carneiro Jr (Guest)
on 2006-03-17 23:34
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} <removed_email_address@domain.invalid>"
>
> it works just fine. But I really want is:
> @from = "#{from_user.display_name} <removed_email_address@domain.invalid>"
>
> 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 'removed_email_address@domain.invalid' and not to my notifier address?
>
> Thanks in advance for the help.
Mark B. (Guest)
on 2006-03-18 00:31
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
>
This topic is locked and can not be replied to.