I'm sending an email from my NodeJS server using Mailgun to a Gmail account, but Gmail strips all the attributes in the email. What is the reason for this and how do I prevent this from happening? I tried encoding the href value using encodeURIComponent but that did nothing for the href tag. I'm also not using any CSS or anything so I'm confused why this is happening.
before:
<a href="/resetpw" id="reset-link" id="reset" target="_blank">Reset Password</a>
after (when I checked the HTML of the email):
<a></a>
Gmail is likely stripping your link from the email because of the href
value of /resetpw
, which, seeing as it's missing a domain name, will refer to https://mail.google.com/resetpw
and a) not work and b) potentially be a security hole (I can't think of a way off-hand, but it makes sense to be overly cautious here on Google's part).
Use a valid URL with a scheme and domain/IP (i.e. http://localhost:3000/resetpw
), fix the invalid HTML like duplicate id
parameters, and it should work just fine.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments