Java 使用play 2.0在电子邮件正文中发送URL
如何使用play 2.0.4 framework和Mailer API在电子邮件正文中发送帐户验证链接。这是密码Java 使用play 2.0在电子邮件正文中发送URL,java,playframework-2.0,mailer,Java,Playframework 2.0,Mailer,如何使用play 2.0.4 framework和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
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);
有什么想法吗
谢谢只需以HTML格式发送您的邮件,并用
环绕您的url即可;
...
sendHtml(邮件体);
此外,我建议使用通用模板构建HTML邮件,您只需使用ie:String htmlBody=views.HTML.mail.render(params.toString()
URL url = new URL("http://www.zenexity.fr/wp-content/themes/images/logo.png");
String cid = email.embed(url, "Zenexity logo");
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);