Email link not working


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


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


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.