I'm trying to send email with mailgun and attaching two files or more with this email:
public static JsonNode sendComplexMessage() throws UnirestException {
HttpResponse<JsonNode> request = Unirest.post("https://api.mailgun.net/v3/" + YOUR_DOMAIN_NAME + "/messages")
.basicAuth("api", API_KEY)
.queryString("from", "Excited User <USER@YOURDOMAIN.COM>")
.queryString("to", "alice@example.com")
.queryString("cc", "bob@example.com")
.queryString("bcc", "joe@example.com")
.queryString("subject", "Hello")
.queryString("text", "Testing out some Mailgun awesomeness!")
.queryString("html", "<html>HTML version </html>")
.field("attachment", new File("/temp/folder/test.txt"))
.asJson();
return request.getBody();
This example is from Mailgun Docs, but it send just single file. I need to send multiple emails.
Any help is appreciated.