NAME

Google::RestApi::GmailApi1::Message - Message object for Gmail.

SYNOPSIS

# Get a message
my $message = $gmail_api->message(id => 'msg_id');
my $details = $message->get();
my $metadata = $message->get(format => 'metadata');

# Modify message labels
$message->modify(
  add_label_ids    => ['STARRED'],
  remove_label_ids => ['UNREAD'],
);

# Trash/untrash
$message->trash();
$message->untrash();

# Permanently delete
$message->delete();

# Get an attachment
my $att = $message->attachment(id => 'att_id');
my $data = $att->get();

DESCRIPTION

Represents a Gmail message. Supports reading, modifying labels, trashing, and deleting messages, as well as accessing attachments.

METHODS

get(format => $format, fields => $fields)

Gets message details. Requires message ID.

Format can be 'full', 'metadata', 'minimal', or 'raw'.

modify(add_label_ids => \@ids, remove_label_ids => \@ids)

Modifies the labels on a message. Requires message ID.

trash()

Moves the message to trash. Requires message ID.

untrash()

Removes the message from trash. Requires message ID.

delete()

Permanently deletes the message. Requires message ID.

attachment(id => $id)

Returns an Attachment object for the given attachment ID.

message_id()

Returns the message ID.

gmail_api()

Returns the parent GmailApi1 object.

AUTHORS

  • Robin Murray mvsjes@cpan.org

COPYRIGHT

Copyright (c) 2019-2026 Robin Murray. All rights reserved.

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.