PutRawMessageContent - Amazon WorkMail

PutRawMessageContent

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.

Note

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.

Request Syntax

POST /messages/messageId HTTP/1.1 Content-type: application/json { "content": { "s3Reference": { "bucket": "string", "key": "string", "objectVersion": "string" } } }

URI Request Parameters

The request uses the following URI parameters.

messageId

The identifier of the email message being updated.

Length Constraints: Minimum length of 1. Maximum length of 120.

Pattern: [a-z0-9\-]*

Required: Yes

Request Body

The request accepts the following data in JSON format.

content

Describes the raw message content of the updated email message.

Type: RawMessageContent object

Required: Yes

Response Syntax

HTTP/1.1 200

Response Elements

If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.

Errors

For information about the errors that are common to all actions, see Common Errors.

InvalidContentLocation

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.

HTTP Status Code: 400

MessageFrozen

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

HTTP Status Code: 400

MessageRejected

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.

HTTP Status Code: 400

ResourceNotFoundException

The requested email message is not found.

HTTP Status Code: 404

Examples

In the following examples, the Authorization header contents (AUTHPARAMS) must be replaced with an AWS Signature Version 4 signature. For more information about creating these signatures, see Signature Version 4 Signing Process in the AWS General Reference.

You only need to learn how to sign HTTP requests if you intend to manually create them. When you use the AWS Command Line Interface (AWS CLI) or one of the AWS SDKs to make requests to AWS, these tools automatically sign the requests for you with the access key that you specify when you configure the tools. When you use these tools, you don't need to learn how to sign requests yourself.

Example

This example illustrates one usage of PutRawMessageContent.

Sample Request

POST /messages/4e87856b-f02f-39d5-a029-9e39ace5b6f1 HTTP/1.1 Host: workmailmessageflow.us-east-1.amazonaws.com Accept-Encoding: gzip, deflate User-Agent: aws-cli/1.16.230 Python/3.7.5 Darwin/18.7.0 botocore/1.12.220 X-Amz-Date: 20210127T151129Z Authorization: AUTHPARAMS Content-Length: 81 Connection: close {"content": {"s3Reference": {"bucket": "My-S3-Bucket", "key": "My-S3-Object-Key"}}}

Sample Response

HTTP/1.1 200 OK Cache-Control: no-cache Content-Type: application/json Date: Wed, 27 Jan 2021 15:11:30 GMT x-amzn-RequestId: ddd7de94-a4eb-4af8-8c3f-1d16cf98b458 Content-Length: 2 Connection: Close {}

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: