I need to send an email every day (in html) with the people registered in my page. Im using Grails plugin “mail” to send the email. it is sent without problems. But, the mail is sent without carriage return, and obviously it results in an almost unreadable mail. This is the code:
ArrayList users=User.findAllByRegistradaBetween(date-1,date)
String results="\r\n"
for (int i=0;i<users.size();i++){
results = results+users[i].mail+"\r\n"
mailService.sendMail {
to 'destinationmail@gmail.com'
from "sendermail@gmail.com"
subject "A subject"
html '<label>Users registered today: '+results+'</label></br>'
}
I tried with \r\n but doesn’t works, as I suspected, in HTML. How can I get something like that?:
etc.
Thank you!
You should try using an HTML line break instead
<br />, the email is HTML so this should work just fine.results = results+users[i].mail+"<br />"