Skip to content

Commit 834fe09

Browse files
committed
create example of multiple reply-tos
1 parent 06b137c commit 834fe09

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

examples/helpers/mail/Example.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,22 @@ public static Mail buildHelloEmail() {
241241
return mail;
242242
}
243243

244+
// Multiple Reply-To addresses on a Mail
245+
public static Mail buildMultipleReplyToEmail() {
246+
Email from = new Email("from@example.com");
247+
String subject = "Hello World from the Twilio SendGrid Java Library";
248+
Email to = new Email("to@example.com");
249+
Content content = new Content("text/plain", "some text here");
250+
Mail mail = new Mail(from, subject, to, content);
251+
252+
Email replyTo1 = new Email("replyto1@example.com");
253+
Email replyTo2 = new Email("replyto2@example.com");
254+
mail.setReplyTo(Arrays.asList(replyTo1, replyTo2));
255+
256+
return mail;
257+
}
258+
259+
244260
public static void baselineExample() throws IOException {
245261
final Mail helloWorld = buildHelloEmail();
246262
send(helloWorld);
@@ -256,6 +272,11 @@ public static void dynamicTemplateExample() throws IOException {
256272
send(dynamicTemplate);
257273
}
258274

275+
public static void MultipleReplyToExample() throws IOException {
276+
final Mail multipleReplyTo = buildMultipleReplyToEmail();
277+
send(multipleReplyTo);
278+
}
279+
259280
private static void send(final Mail mail) throws IOException {
260281
final SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY"));
261282
sg.addRequestHeader("X-Mock", "true");

0 commit comments

Comments
 (0)