Forum: Ruby on Rails email link not working

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Shockmeister (Guest)
on 2009-02-18 11:54
(Received via mailing list)
Hi all,

I've integrated a "reset password" facility on the site I'm developing
allowing the user to reset their password if they forget it. The
problem I am having is that the link to the reset page is not showing
up as a hyperlink.

 My User_Mailer looks like this

    def forgot_password(user)
    @subject    += 'linkITB - Reset Password'
    @body[:url]  = "http://localhost:3000/user/reset_password/"#

    def setup_email(user)
      @recipients  = "#{}"
      @from        = "removed_email_address@domain.invalid"
      @subject     = "[] "
      @sent_on     =
      @body[:user] = user

My views/ user_mailer is:

Hi <%= @user.user_name %>,

Your password has been reset.

You can now login by using the following link <%= @url %>


The linkITB team
Gavin (Guest)
on 2009-02-18 12:20
(Received via mailing list)
This may be just a typing-error but have you closed the quotations
after password/ in your mailer model like you have here?

Try setting this in the mailer method:

body :url => "http://localhost:3000/user/reset_password/#

and then in the view <%= link_to "click here", @url %>

Or ---

In the view simply specify the full url
<%= link_to 'click here', url_for(:controller => 'users', :action =>
'reset_password', :params=> (your params)), :host => 'your host here)

It's important to specify the host in the mailer views.

Hope this helps
Shockmeister (Guest)
on 2009-02-18 13:31
(Received via mailing list)
Yeah, sorry, that was a typo!! It should have been like you have
written it.

I'll try the second implementation and see if that works.

This topic is locked and can not be replied to.