How Can I put a HTML link Inside an email body?

前端 未结 5 2027
伪装坚强ぢ
伪装坚强ぢ 2021-02-19 07:59

I have an application thats can send mails, implemented in Java. I want to put a HTML link inside de mail, but the link appears as normal letters, not as HTML link... How can i

5条回答
  •  北恋
    北恋 (楼主)
    2021-02-19 08:27

    We can create html link in the email body by using java code.In my case I am developing reset password where I should create link and send to the user through the mail.you will create one string.With in a string you type all the url.If you add the http to the that .it behaves like link with in the mail.

    Ex:String mailBody ="http://localhost:8080/Mail/verifytoken?token="+ token ;

    you can send some value with url by adding query string.Her token has some encrypted value.

    put mailBody in your mail body parameter. ex": "Hi "+userdata.getFirstname()+ "\n\n You have requested for a new password from the X application. Please use the below Link to log in."+ "\n\n Click on Link: "+mailBody);

    The above is the string that is parameter that you have to pass to your mail service.Email service takes parameters like from,to,subject,body.Here I have given body how it should be.you pass the from ,to,subject values according to your cast

提交回复
热议问题