[ link to the project's root URL in mailService ]
in Grails project i need to put the project's root link in the email body , using mailService in Mail plugin , is this the proper way or there are some better ways , here is my code :
def webUtils = WebUtils.retrieveGrailsWebRequest()
def request = webUtils.getCurrentRequest()
def link ="http://" + request.serverName+'/'+grails.util.Metadata.current.'app.name'
Answer 1
Try creating the link using the createLink
or link
tags.
<g:link uri='/' absolute='true'>My Link</g:link>
<!-- OR -->
<a href="${g.createLink(uri: '/', absolute: true)}">MyLink</a>
Using absolute ensures the link is prefixed with grails.serverURL from your configuration.