From 618886e0a2a5242e02e98842dd98af7569e05535 Mon Sep 17 00:00:00 2001 From: schmidthub Date: Thu, 2 Apr 2015 10:45:48 -0500 Subject: [PATCH] Fix for bulk email merge fields Before change all emails would send with last merge field value. Now each email gets the merge field value from the the corresponding index in the list from the second parameter in addSubstitution function of Sendgrid.Email. --- src/classes/Smtpapi.cls | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/classes/Smtpapi.cls b/src/classes/Smtpapi.cls index a041fe9..324ca72 100644 --- a/src/classes/Smtpapi.cls +++ b/src/classes/Smtpapi.cls @@ -57,10 +57,7 @@ global class Smtpapi { } public Header addSubstitution(String key, List val) { - for (Integer i = 0; i < val.size(); i++) { - List val_in_array = new List { val[i] }; - this.sub.put(key, val_in_array); - } + this.sub.put(key, val); return this; } @@ -117,4 +114,4 @@ global class Smtpapi { return this; } } -} \ No newline at end of file +}