How to BCC all emails in Amazon WorkMail

0

Within Amazon WorkMail, under the organization settings, How do you setup rule to BCC all inbound/outbound emails? I have tried using a Lambda function and added an extra setting called "recipients", but that didn't work.

質問済み 5ヶ月前193ビュー
2回答
0

Hi,

How are you adding the recipient to the email? The correct way to do this would be using a synchronous lambda where you add a recipient by returning something like this: (From Docs)

The following example demonstrates the structure of a synchronous Run Lambda response for adding recipients to the email message. This does not update the To or CC fields of the email message.

{
    "actions": [
      {
        "action": { 
          "type": "DEFAULT" 
        },
        "recipients": [
          "new-recipient@example.com"
         ]
      },
      {
        "action": { 
          "type": "DEFAULT" 
        },
        "allRecipients": true
      }
    ]
}

Kind regards, Robin

AWS
エキスパート
回答済み 5ヶ月前
profile picture
エキスパート
レビュー済み 5ヶ月前
0

Hi Robin, I finally got it to work. I created my Lambda function with the following code and created an Organization Inbound rule calling Synchronous Lambda function. This also works for the same with Outbound rule. Code is slightly different for outbound.

try:

    # workmail = boto3.client('workmailmessageflow', region_name='us-west-2')
    mailBcc = ['bcc@email.com']
    recipients = event['envelope']['recipients']
    
    to_addr = 'from@email.com'
    
    for item in recipients:
        if to_addr in item.values():
            
            return {
                'actions': [
                {
                    'action': { 'type': 'DEFAULT' },
                    'recipients': mailBcc
                },
                {
                    'action': { 'type': 'DEFAULT' },
                    'allRecipients': True
                }
            ]}        
    
except Exception as e:
    print(e)
    raise e

return {
    'actions': [
    {
        'allRecipients': True,
        'action': { 'type': 'DEFAULT' }
回答済み 5ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ