如何使用Play 2.0.4框架和Mailer API在电子邮件正文中发送帐户验证链接。这是代码
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);
我检查了文档,我发现了类似的内容,但它的内容为1.2.3
URL url = new URL("http://www.zenexity.fr/wp-content/themes/images/logo.png");
String cid = email.embed(url, "Zenexity logo");
任何想法?
由于
答案 0 :(得分:1)
只需将您的邮件作为HTML发送,并使用<a>
标记将您的网址包围起来。
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);