如何在 Amazon SES SendRawEmail 中添加抄送和密送? [英] How to add Cc and Bcc in Amazon SES SendRawEmail?

查看:33
本文介绍了如何在 Amazon SES SendRawEmail 中添加抄送和密送?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在sendrawemail(java)中添加抄送和密送收件人列表.我只是将所有收件人添加到一个列表中并发送邮件.没有单独的方法可以为 SendRawEmailRequest 设置抄送和密送.

有没有办法设置Destination类型的对象?

List接收者 = 新的 ArrayList();receicipients.addAll(mailToRecipients);receicipients.addAll(mailCcRecipients);receipiients.addAll(mailBccRecipients);SendRawEmailRequest rawEmailRequest = new SendRawEmailRequest(rawMessage).withDestinations(receipients);

解决方案

关于 SendRawEmail,您应该能够通过在原始数据中设置收件人、抄送和密件抄送目的地来区分它们消息头.如果您没有在请求对象中明确指定目的地,则会改为检查标头.如果这样做,则不会检查标题.

这是 JustinC@ 关于这个问题的很好的例子AWS 在 AWS 论坛上分享:

<块引用>

 目的地:(空)至:A@example.com抄送:B@example.com密件抄送:C@example.com

以上消息会发送给A@、B@、C@example.com这三个人.相反,如果您发送以下输入:

 目的地:A@example.com至:A@example.com抄送:B@example.com密件抄送:C@example.com

该消息将仅发送至 A@example.com.

How to add the list of Cc and Bcc recipients in sendrawemail (java). I'm just adding all the recipients to one list and sending the mail. There is no separate method to set Cc and Bcc for SendRawEmailRequest.

Is there any way to set object of Destination type?

List<String> receipients = new ArrayList<String>();
receipients.addAll(mailToRecipients);
receipients.addAll(mailCcRecipients);
receipients.addAll(mailBccRecipients);

SendRawEmailRequest rawEmailRequest = new   SendRawEmailRequest(rawMessage).withDestinations(receipients);

解决方案

Regarding SendRawEmail, you should be able to differentiate To, Cc, and Bcc destinations by setting them in your raw message headers. If you don't explicitly specify destinations in the request object, the headers will be checked instead. If you do, the headers won't be checked.

Here's a great example regarding this problem that JustinC@AWS shared on the AWS forums:

   Destinations: (empty)
   To: A@example.com
   Cc: B@example.com
   Bcc: C@example.com

The above message will be sent to all three of A@, B@, C@example.com. In contrast, if you send the following input:

   Destinations: A@example.com
   To: A@example.com
   Cc: B@example.com
   Bcc: C@example.com

That message will be delivered only to A@example.com.

这篇关于如何在 Amazon SES SendRawEmail 中添加抄送和密送?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆