I am trying to send and HTML based message which includes a link using mailgun in Java. The issue is that the HTML code is displayed as is in the email client and it does not render it as HTML formatted content.
I am refering to the example given in this URL -
https://documentation.mailgun.com/user_manual.html#sending-via-api
Client client = Client.create();
client.addFilter(new HTTPBasicAuthFilter("api",
"key-***"));
WebResource webResource =
client.resource("https://api.mailgun.net/v3/sandbox***.mailgun.org/" + "messages");
FormDataMultiPart form = new FormDataMultiPart();
form.field("from", "Admin <[email protected]>");
form.field("to", "User <[email protected]>");
form.field("subject", "Hello User");
form.field("text", "Testing some Mailgun awesomness! <BR> this should be in new line <BR>this shoud aso be be new line");
return webResource.type(MediaType.MULTIPART_FORM_DATA).post(ClientResponse.class, form);
Can anybody having experience with mailgun help me. I need to send email with clickable links in it (anchor tags).
From the api documentation try the following:
form.field('html','<html><a href="http://stackoverflow.com">HTML version of the body</a></html>');