Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending links to email with nodemailer not working

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.

like image 209
jmona789 Avatar asked Oct 20 '16 15:10

jmona789


People also ask

What is SMTP in Nodemailer?

SMTP is the main transport in Nodemailer for delivering messages. SMTP is also the protocol used between different email hosts, so its truly universal. Almost every email delivery provider supports SMTP based sending, even if they mainly push their API based sending.

How many emails can you send with Nodemailer?

The default value is 100 which means that once a connection is used to send 100 messages it is removed from the pool and a new connection is created. Set maxConnections to whatever your system can handle.

Does Nodemailer work with gmail?

Once less secure apps is enabled now nodemailer can use your gmail for sending the emails.


1 Answers

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.

like image 130
jmona789 Avatar answered Nov 05 '22 19:11

jmona789