You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Readme feedback - confusion around template id #46
final String EMAIL_ID_WELCOME_EMAIL = "EMAIL-ID-HERE";
final String TEMPLATE_ID = "TEMPLATE-ID-HERE";
I was a bit confused about what the email id is - at first I thought I was looking for my account email id. I didn't realize that it was actually actually an email template id!
I was getting a missing template id error then I decided to try this...
final String TEMPLATE_ID = "tem_jWXqetc...";
final String EMAIL_ID_WELCOME_EMAIL = TEMPLATE_ID;
everything worked! I think this makes it's easier to see the relationship if in fact they are the same. But I could be wrong....
Personally, I think this signature might even better for a first experience with SendWithUs - fantastic service by the way - I'm a bit embarrassed that I struggled here - everything else was straight-forward
One more thing - I think its natural that once a dev sends an email to 1 person, they may want figure out how to send it to multiple. Without getting into personalization which could be its own recipe, I would have also liked to see a cc example.
That's something I had to google, and couldn't find an example so came up with the following by looking at what setCcRecipients expects:
String[] ccEmails = {"[email protected]", "[email protected]"};
HashMap<String, Object>[] ccRecipientsMap = (HashMap<String, Object>[]) new HashMap[ccEmails.length];
int i = 0;
for ( String email : ccEmails){
HashMap<String, Object> hashMap = new HashMap<String, Object>();
hashMap.put("address", email);
ccRecipientsMap[i] = hashMap;
i++;
}
SendWithUsSendRequest request = new SendWithUsSendRequest()
.setEmailId(EMAIL_ID_WELCOME_EMAIL)
.setRecipient(recipientMap)
.setCcRecipients(ccRecipientsMap)
.setSender(senderMap)
.setEmailData(emailDataMap);
SendReceipt sendReceipt = sendwithusAPI.send(request);
Once you have the cc, bcc is a piece of cake!
props to Tufan Görel's article from 2016 which demonstrates how to create a HashMap as a store - typically we see an ArrayList for this structure.
Activity
headwinds commentedon Feb 26, 2022
One more thing - I think its natural that once a dev sends an email to 1 person, they may want figure out how to send it to multiple. Without getting into personalization which could be its own recipe, I would have also liked to see a cc example.
That's something I had to google, and couldn't find an example so came up with the following by looking at what setCcRecipients expects:
Once you have the cc, bcc is a piece of cake!
props to Tufan Görel's article from 2016 which demonstrates how to create a HashMap as a store - typically we see an ArrayList for this structure.
demoore commentedon Apr 4, 2022
Thanks @headwinds! I really appreciate the level of detail you've gone into here.
I've added your recommendations into #49 and hopefully simplified the example a bit (who needs two template IDs?).