I'm using MimeMessage setContent to send http body emails from my application.
MimeMessage message = new MimeMessage(sessionProps());
message.setSender(addressFrom);
message.setSubject(subject);
message.setContent(template, "text/html;charset=UTF-8");
This template contains a button that calls my rest api (see code bellow).
<body>
.....
<p>
<button type="button" onclick="userAction()">Click Me!</button>
</p>
<script type="text/javascript">
function userAction() {
const response = fetch(restApi);
const myJson = response.json(); //extract JSON from the http response
alert(myJson);
}
</script>
</body>
My simple rest
@GetMapping("/hello/")
public void hello() {
System.out.println("hello world");
}
Unfortunately, when I click the button inside gmail body email nothing is showing, Any thoughts ? Thank you