From 85dedc85fd587d7dca912ed17e059ba74b34d333 Mon Sep 17 00:00:00 2001 From: Ivan Stoyanov Date: Fri, 30 Jun 2017 14:11:00 +0300 Subject: [PATCH] Add the id parameter only when there is none. --- pom.xml | 2 +- src/main/java/com/storakle/mailgun/MailgunApiManager.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 94c0bf0..4ec34a9 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.storakle mailgun - 0.1.14 + 0.1.15 src/main/java diff --git a/src/main/java/com/storakle/mailgun/MailgunApiManager.java b/src/main/java/com/storakle/mailgun/MailgunApiManager.java index 60723db..21687d1 100644 --- a/src/main/java/com/storakle/mailgun/MailgunApiManager.java +++ b/src/main/java/com/storakle/mailgun/MailgunApiManager.java @@ -82,7 +82,11 @@ public List sendMessage(Message message, List re // Prepare the recipient variables object. ObjectNode recipientVariablesObject = objectMapper.createObjectNode(); recipient.getVariables().forEach((key, value) -> recipientVariablesObject.put(key, value)); - recipientVariablesObject.put("id", i + 1); + + if(!recipientVariablesObject.has("id")) + { + recipientVariablesObject.put("id", i + 1); + } recipientEmails.add(recipient.getEmail());