Question

How can I send an account verification link in email body using play 2.0.4 framework with Mailer API. Here is the code

MailerAPI mail = play.Play.application().plugin(MailerPlugin.class).email();        
mail.setSubject("Complete Your Registration");
mail.addFrom(" Live Events<umair.tum@gmail.com>");
mail.addRecipient(formUser.email);
String mailBody = "Please Click on the Below Link to Complete Your Registration
"localhost:9000/verifyUser?email="+ formUser.email + "&verifyCode=" + formUser.verifierCode;
mail.send(mailBody);

I checked the documentation I found something like this but its for play 1.2.3

 URL url = new URL("http://www.zenexity.fr/wp-content/themes/images/logo.png");
 String cid = email.embed(url, "Zenexity logo");

Any Idea?

Thanks

Was it helpful?

Solution

Just send your message as HTML and surround your url with <a> tag.

String mailBody = "Please Click on the Below Link to Complete Your Registration
"<a href=\"http://localhost:9000/verifyUser?email="+ formUser.email + "&verifyCode=" + formUser.verifierCode + "\">click here</a>";
...
mailer.sendHtml(mailBody);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top