0

I am passing the complete href encoded value from the back end. and sending a mail to user. In the mail body we have an anchor link; by clicking on it the mail body should open with predefined subject and body. The mail is getting triggered but the when I click on the anchor link, the mail is not opening.

Java code:

    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 file:

  <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

But clicking on link the maito functionality is not working. Please help me.

Ole V.V.
  • 81,772
  • 15
  • 137
  • 161
bharathi
  • 6,019
  • 23
  • 90
  • 152

0 Answers0