HTML 按钮未重定向到 Java 邮件正文中的给定链接

我想在我创建的 HTML 电子邮件模板中添加一个按钮。我已经创建了一个按钮,但是当我点击它时,链接没有出现。任何人都可以帮助我解决我的问题吗?


这是我的代码:


messageBodyPart.setContent("<h1>You Have a Promotion</h1> <h3>Your First Name :</h3>" + FirstNm + 

                      "<h3>Your Last Name :</h3>" + LastNm + "<h3>Your Employee ID :</h3>" + Employeeid + 

                      " <br/> <form>\r\n" + 

                            "<input class=\"MyButton\" onclick =\"http://localhost:8080/update/status/password/ACCEPT\" type = \"button\" value =\"Accept Your Promotion\" />\r\n" + 

                      "</form>","text/html");


白板的微信
浏览 207回答 2
2回答

慕姐8265434

尝试在元素上添加锚标记和href属性而不是onclick事件input。messageBodyPart.setContent("<h1>You Have a Promotion</h1> <h3>Your First Name :</h3>" + FirstNm +&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "<h3>Your Last Name :</h3>" + LastNm + "<h3>Your Employee ID :</h3>" + Employeeid +&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; " <br/> <form>\r\n" +&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "<a href=\"http://localhost:8080/update/status/password/ACCEPT\"><input class=\"MyButton\"&nbsp; type = \"button\" value =\"Accept Your Promotion\" /></a>\r\n" +&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "</form>","text/html");
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java