PutRawMessageContentCommand

Updates the raw content of an in-transit email message, in MIME format.

This example describes how to update in-transit email message. For more information and examples for using this API, see Updating message content with AWS Lambda .

Updates to an in-transit message only appear when you call PutRawMessageContent from an AWS Lambda function configured with a synchronous Run Lambda  rule. If you call PutRawMessageContent on a delivered or sent message, the message remains unchanged, even though GetRawMessageContent  returns an updated message.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { WorkMailMessageFlowClient, PutRawMessageContentCommand } from "@aws-sdk/client-workmailmessageflow"; // ES Modules import
// const { WorkMailMessageFlowClient, PutRawMessageContentCommand } = require("@aws-sdk/client-workmailmessageflow"); // CommonJS import
const client = new WorkMailMessageFlowClient(config);
const input = { // PutRawMessageContentRequest
  messageId: "STRING_VALUE", // required
  content: { // RawMessageContent
    s3Reference: { // S3Reference
      bucket: "STRING_VALUE", // required
      key: "STRING_VALUE", // required
      objectVersion: "STRING_VALUE",
    },
  },
};
const command = new PutRawMessageContentCommand(input);
const response = await client.send(command);
// {};

PutRawMessageContentCommand Input

Parameter
Type
Description
content
Required
RawMessageContent | undefined

Describes the raw message content of the updated email message.

messageId
Required
string | undefined

The identifier of the email message being updated.

PutRawMessageContentCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.

Throws

Name
Fault
Details
InvalidContentLocation
client

WorkMail could not access the updated email content. Possible reasons:

  • You made the request in a region other than your S3 bucket region.

  • The S3 bucket owner  is not the same as the calling AWS account.

  • You have an incomplete or missing S3 bucket policy. For more information about policies, see Updating message content with AWS Lambda   in the WorkMail Administrator Guide.

MessageFrozen
client

The requested email is not eligible for update. This is usually the case for a redirected email.

MessageRejected
client

The requested email could not be updated due to an error in the MIME content. Check the error message for more information about what caused the error.

ResourceNotFoundException
client

The requested email message is not found.

WorkMailMessageFlowServiceException
Base exception class for all service exceptions from WorkMailMessageFlow service.