Sending links to email with nodemailer not working

jmona789 picture jmona789 · Oct 20, 2016 · Viewed 9.4k times · Source

I'm working on an app and I'm using nodemailer to send recovery emails for users to reset their passwords and I'm trying to send a link to a page that will allow them to change their password. I'm using the following for the body of the email

html: '<p>Click <a href="localhost:3000/sessions/recover/' + recovery_token + '">here</a> to reset your password</p>'

But when I test it I just get an email with the text and no link, using the ispector shows <a>here</a>, so it is sending the a tags, its just not sending the href.

Answer

jmona789 picture jmona789 · Oct 20, 2016

I figured out the answer after I typed this question, so I guess I'll just answer my own question in case anyone else has the problem. I needed to include the http:// in the email, when I changed the body of the email to

html: '<p>Click <a href="http://localhost:3000/sessions/recover/' + recovery_token + '">here</a> to reset your password</p>'

it started working.