I am using Mailgun as my service provider. Here, I have a java code to send mails to my clients through mailgun. I have created a file path to my html file. I need to execute it in my client side mail as template. How to achieve this through my following coding???
public static ClientResponse SendSimpleMessage()
{
Path p4 = FileSystems.getDefault().getPath("c:\\software\\k3.html");
Client client = Client.create();
client.addFilter(new HTTPBasicAuthFilter("api","key-*****"));
com.sun.jersey.api.client.WebResource webResource
=client.resource("https://api.mailgun.net/v2/****/messages");
MultivaluedMapImpl formData = new MultivaluedMapImpl();
formData.add("from", "*****r@outlook.com");
formData.add("to", "***@gmail.com");
formData.add("subject", "Creating Mailing List");
formData.add("text", "Mailing List was created successfully");
formData.add("html",p4.toUri());
return webResource.post(ClientResponse.class,formData);
}
I have doubt in the "p4.toURI()" statement. Kindly help me.....