Search code examples
grails

how to include a href tag in mail body?


I am using grails mail plugin to send email as shown below. how can i include link in body?

mailService.sendMail{
                    delegate.to em
                    delegate.subject params['subject']
                    delegate.body "${params['body']} \n\nPlease click <a href='${l}'> Unsubscribe </a> to unsubscribe from the list."
                }

In the received email it is received as

Please click <a href='https://ne-palmr.com/road/subscriptionCancellation/cancelSubscription?email=test%40gmail.com&from=979&t=d4007eb1ec361d8c3ec82f9525af2d08'> Unsubscribe </a> to unsubscribe from the list.

whereas the expected result is

Please click Unsubscribe to unsubscribe from the list.

Solution

  • Will duplicate Slack answer here: You need to change body to html. Also you don't need to use delegate before methods