Monday 15 February 2010

url - Spring MVC - Insert link in email -


Sorry for the newbie question, but I'm building a web application with spring MVC. I have created a registration function which sends emails to the user on the successful register. The email contains a link to confirm the user's email address. All this is working well but the URL has been written with hard work for the link within the e-mail:

  "http: // localhost: 8080 / webapp / confirmEmail"   

My concern is that when I finally deploy my app, the email link will still point to the local host

I have tried getContextPath () But it only takes advantage of "/ webpubs", so I do not need much URL to put it in full URL What is the best way to scroll?

NB - I am not using the templateing tool to create an email, I am doing this inside the controller (like

  string body = "& lt; Html> gt; & lt; body & gt; ... & lt; / body & gt; & lt; / html & gt; "   

You can get the URL using getRequestURL () to HttpServletRequest . Once you have the URL is the server URL (protocol, DNS and port number, if any) and its use during creating email content Are involved.

No comments:

Post a Comment