Closed Ananda2126 closed 3 years ago
@Ananda2126 are you saying that the addresses listed in the Bcc
are not hidden from the recipients? Which email client are you using?
@Ananda2126 are you saying that the addresses listed in the
Bcc
are not hidden from the recipients? Which email client are you using?
I would like to hide "to" list recipients from seeing others "to" list user email. I am able to achieve this using "X-SMTPAPI" header "to" in V2 api. But with V3 api this header is no more working with Personalization "to" list.
With going through other blogs, they were suggesting to use multiple Personalization. But when I use multiple Personalization with bcc and cc, it trigger duplicate mail to bcc and cc recipients. You can refer code snippet.
And also I tried setting bcc and cc recipients to 1st Personalization object, so that it will not trigger duplicate mail to bcc and cc user. But bcc and cc is not available for mails other than the 1st Personalization mail.
Code Snippet
Mail mail = new Mail(); Email fromEmail = new Email(); fromEmail.setName("TEST"); fromEmail.setEmail("test@test.com"); mail.setFrom(fromEmail); mail.setSubject("subject");
Personalization personalization;
for(String to: getRecipients().getToEmails()){
personalization = new Personalization();
personalization.addTo(new Email(to));
mail.addPersonalization(personalization);
}
for(String bcc: bccList){ mail.getPersonalization().get(0).addBcc(new Email(bcc)); } for(String cc: ccList){ mail.getPersonalization().get(0).addCc(new Email(cc)); }
mail.addPersonalization(personalization);
Content content = new Content(); content.setType("text/html"); content.setValue("Message Body"); mail.addContent(content);
@reference : https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/#bcc-with-the-x-smtpapi
I'm not too sure I follow. The X-SMTPAPI
header is supposed to simulate the Bcc
functionality. The addresses specified in Bcc
is what will be hidden from non recipients and not the To
addresses.
@shwetha-manvinkurke Please find below references https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/#bcc-behavior
As per above document, we can simulate "bcc" behavior for "to" list as well and there are 2 ways to achieve this. I was using 2nd option with v2 api and able to achieve this feature. @Reference : https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/#bcc-with-the-x-smtpapi
But with v3 api personalization "to" list takes priority over x-smtpapi header "to" list.
@Ananda2126 Thank you for the clarification. Wasn't aware you could actually do that. In this case, it looks to me like it's a problem with the underlying API itself and not the helper. I would recommend you reach out to support for the resolution.
Issue Summary
Unable to hide "to" recipient to see other "to" recipients email with multiple bcc and cc.
Steps to Reproduce
Code Snippet
Exception/Log
Technical details: