mailto链接邮件正文无法正常工作

时间:2018-05-09 07:27:08

标签: java email hyperlink

我从后端传递完整的href编码值。并向用户发送邮件。在邮件正文中我们有一个锚链接;通过单击它,邮件正文应该打开预定义的主题和正文。邮件被触发但是当我点击锚链接时,邮件没有打开。

Java代码:

    String rejectBody = "mailto:?subject=Rejected - PP - Claim record #20170085&body=Dear <User name>,\r\n" + 
            "Your PP –Claim Record #20170085 request has been Rejected.\r\n" + 
            "This is an automated email. Please do not reply.";
    String approvedBody = "mailto:?subject=Approved - PP - Claim record #20170085&body=Dear <User name>,\r\n" + 
            "Your PP –Claim Record #20170085 request has been Approved.\r\n" + 
            "This is an automated email. Please do not reply.";
    try {
        String encoderejectBody=URLEncoder.encode( rejectBody, "UTF-8" );
        String encodeApprovedBody=URLEncoder.encode( approvedBody, "UTF-8" );
        claimDetails.setApprovedBody(encodeApprovedBody);
        claimDetails.setRejectBody(encoderejectBody);
    } catch (UnsupportedEncodingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }  

Velocity vm文件:

  <div>
     <table align="center"  cellspacing="40">
        <th  style="background-color: #4CAF50;border-color: #4CAF50;border: 2px solid #4CAF50;padding: 10px 25px 10px 25px;text-align: center;border-radius:5px;">
           <a style="display: block;color: #ffffff;font-size: 15px;text-decoration: none;" href=${email.rejectBody}>
           Reject
           </a>
        </th>
        <th style="background-color: #4CAF50;border-color: #4CAF50;border: 2px solid #4CAF50;padding: 10px 25px 10px 25px;text-align: center;border-radius:5px;">
           <a style="display: block;color: #ffffff;font-size: 15px;text-decoration: none;" href=${email.approvedBody}>
           Approve
           </a>
        </th>
        </table>
  </div>

Ouptut:

enter image description here

但点击链接maito功能无效。 请帮帮我。

0 个答案:

没有答案