From 23410166f56c82f6ec9b24f9112db94e16a212f4 Mon Sep 17 00:00:00 2001 From: johnkelesidis <72185528+johnkelesidis@users.noreply.github.com> Date: Thu, 1 Aug 2024 16:08:23 +0300 Subject: [PATCH 1/2] Update README.md --- README.md | 53 ----------------------------------------------------- 1 file changed, 53 deletions(-) diff --git a/README.md b/README.md index 0930fd1..ca2356b 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ MailerSend Java SDK - [Add CC, BCC recipients](#add-cc-bcc-recipients) - [Send a template-based email](#send-a-template-based-email) - [Advanced personalization](#advanced-personalization) - - [Simple personalization](#simple-personalization) - [Send email with attachment](#send-email-with-attachment) - [Schedule an email](#schedule-an-email) - [Send bulk emails](#send-bulk-emails) @@ -241,12 +240,6 @@ public void sendEmail() { email.setTemplateId("Your MailerSend template ID"); - // you can add a variable for a specific recipient - email.addVariable(recipient, "variable name", "variable value"); - - // you can use the addVariable overload to add a variable to all recipients - email.addVariable("all recipients variable name", "variable value"); - MailerSend ms = new MailerSend(); ms.setToken("Your API token"); @@ -312,52 +305,6 @@ public void sendEmail() { } ``` -### Simple personalization - -```java -import com.mailersend.sdk.emails.Email; -import com.mailersend.sdk.MailerSend; -import com.mailersend.sdk.MailerSendResponse; -import com.mailersend.sdk.exceptions.MailerSendException; - -public void sendEmail() { - - Email email = new Email(); - - email.setFrom("name", "your email"); - - email.setSubject("Subject {$var1} {$var2}"); - - email.setPlain("This is the text version with a {$var1} and a {$var2}.") - email.setHtml("

This is the HTML version with a {$var1} and a {$var2}.

"); - - Recipient recipient = new Recipient("name", "your@recipient.com"); - - email.addRecipient(recipient); - - email.setTemplateId("Your MailerSend template ID"); - - // you can add a variable for a specific recipient - email.addVariable(recipient, "var1", "variable"); - - // you can use the addVariable overload to add a variable to all recipients - email.addVariable("var2", "second variable"); - - MailerSend ms = new MailerSend(); - - ms.setToken("Your API token"); - - try { - - MailerSendResponse response = ms.emails().send(email); - System.out.println(response.messageId); - } catch (MailerSendException e) { - - e.printStackTrace(); - } -} -``` - ### Send email with attachment ```java From e2e73b2454ddbd72ba44842ee56067c283639ea8 Mon Sep 17 00:00:00 2001 From: johnkelesidis <72185528+johnkelesidis@users.noreply.github.com> Date: Thu, 1 Aug 2024 16:09:42 +0300 Subject: [PATCH 2/2] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ca2356b..10e3022 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ MailerSend Java SDK - [Send an email](#send-an-email) - [Add CC, BCC recipients](#add-cc-bcc-recipients) - [Send a template-based email](#send-a-template-based-email) - - [Advanced personalization](#advanced-personalization) + - [Personalization](#personalization) - [Send email with attachment](#send-email-with-attachment) - [Schedule an email](#schedule-an-email) - [Send bulk emails](#send-bulk-emails) @@ -255,7 +255,7 @@ public void sendEmail() { } ``` -### Advanced personalization +### Personalization ```java import com.mailersend.sdk.emails.Email; @@ -283,7 +283,7 @@ public void sendEmail() { // you can add personalization for each recipient separately email.addPersonalization(recipient, "var2 name", "personalization value"); - // you can also add POJOs as advanced personalization provided they can be serialized to JSON via Gson and do not have any object properties + // you can also add POJOs as personalization provided they can be serialized to JSON via Gson and do not have any object properties MyPojo obj = new MyPojo(); obj.property1 = "property 1 value"; obj.array1 = {1, 2, 3, 4};