getRawMessageContent method

Future<GetRawMessageContentResponse> getRawMessageContent({
  1. required String messageId,
})

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

May throw ResourceNotFoundException.

Parameter messageId : The identifier of the email message to retrieve.

Implementation

Future<GetRawMessageContentResponse> getRawMessageContent({
  required String messageId,
}) async {
  ArgumentError.checkNotNull(messageId, 'messageId');
  _s.validateStringLength(
    'messageId',
    messageId,
    1,
    120,
    isRequired: true,
  );
  final response = await _protocol.sendRaw(
    payload: null,
    method: 'GET',
    requestUri: '/messages/${Uri.encodeComponent(messageId)}',
    exceptionFnMap: _exceptionFns,
  );
  return GetRawMessageContentResponse(
    messageContent: await response.stream.toBytes(),
  );
}