I am using nodemailer to send mails in nodejs. I am embedding hyperlink to mailbody it is working fine.
My sample mailbody is below
`This is confirmation mail.\n
please click below link to login
http://${req.headers.host}/login\n\n
\n`
Observe the scenario, If i open my page as localhost:port it is sending mail with localhost:port when I open with Ipaddress:port then it is sending with Ipaddress:port.
Here comes the my problem I got mail successfully,now I opened my mail in another system and from there I click on the link then it is getting the server can't be reached. This is quite straight forward as the server is running on another machine but I am trying to open in different machine with locahost.
So how can i send the server ip address in that mail. I have also seen about server.address().address but how to use I got confused.
are you using ExpressJs you can use use this
req.hostname on nodejs Server try this and let me know if works or req.ip