Gmail
import { Gmail } from "https://googleapis.deno.dev/v1/gmail:v1.ts";
The Gmail API lets you view and manage Gmail mailbox data like threads, messages, and labels.
§Methods
Immediately and permanently deletes the specified draft. Does not simply trash it.
The ID of the draft to delete.
The user's email address. The special value me
can be used to indicate the authenticated user.
Gets the specified draft.
The ID of the draft to retrieve.
The user's email address. The special value me
can be used to indicate the authenticated user.
Lists the drafts in the user's mailbox.
The user's email address. The special value me
can be used to indicate the authenticated user.
Gets the current user's Gmail profile.
The user's email address. The special value me
can be used to indicate the authenticated user.
Lists the history of all changes to the given mailbox. History results are
returned in chronological order (increasing historyId
).
The user's email address. The special value me
can be used to indicate the authenticated user.
Immediately and permanently deletes the specified label and removes it from any messages and threads that it is applied to.
The ID of the label to delete.
The user's email address. The special value me
can be used to indicate the authenticated user.
Lists all labels in the user's mailbox.
The user's email address. The special value me
can be used to indicate the authenticated user.
Gets the specified message attachment.
The ID of the attachment.
The ID of the message containing the attachment.
The user's email address. The special value me
can be used to indicate the authenticated user.
Deletes many messages by message ID. Provides no guarantees that messages were not already deleted or even existed at all.
The user's email address. The special value me
can be used to indicate the authenticated user.
Modifies the labels on the specified messages.
The user's email address. The special value me
can be used to indicate the authenticated user.
Immediately and permanently deletes the specified message. This operation
cannot be undone. Prefer messages.trash
instead.
The ID of the message to delete.
The user's email address. The special value me
can be used to indicate the authenticated user.
Gets the specified message.
The ID of the message to retrieve. This ID is usually retrieved using messages.list
. The ID is also contained in the result when a message is inserted (messages.insert
) or imported (messages.import
).
The user's email address. The special value me
can be used to indicate the authenticated user.
Imports a message into only this user's mailbox, with standard email delivery scanning and classification similar to receiving via SMTP. This method doesn't perform SPF checks, so it might not work for some spam messages, such as those attempting to perform domain spoofing. This method does not send a message.
The user's email address. The special value me
can be used to indicate the authenticated user.
Directly inserts a message into only this user's mailbox similar to IMAP APPEND
, bypassing most scanning and classification. Does not send a
message.
The user's email address. The special value me
can be used to indicate the authenticated user.
Lists the messages in the user's mailbox.
The user's email address. The special value me
can be used to indicate the authenticated user.
Modifies the labels on the specified message.
The ID of the message to modify.
The user's email address. The special value me
can be used to indicate the authenticated user.
Sends the specified message to the recipients in the To
, Cc
, and Bcc
headers. For example usage, see Sending
email.
The user's email address. The special value me
can be used to indicate the authenticated user.
Creates and configures a client-side encryption identity that's authorized to send mail from the user account. Google publishes the S/MIME certificate to a shared domain-wide directory so that people within a Google Workspace organization can encrypt and send mail to the identity.
The requester's primary email address. To indicate the authenticated user, you can use the special value me
.
Deletes a client-side encryption identity. The authenticated user can no longer use the identity to send encrypted messages. You cannot restore the identity after you delete it. Instead, use the CreateCseIdentity method to create another identity with the same configuration.
The primary email address associated with the client-side encryption identity configuration that's removed.
The requester's primary email address. To indicate the authenticated user, you can use the special value me
.
Retrieves a client-side encryption identity configuration.
The primary email address associated with the client-side encryption identity configuration that's retrieved.
The requester's primary email address. To indicate the authenticated user, you can use the special value me
.
Lists the client-side encrypted identities for an authenticated user.
The requester's primary email address. To indicate the authenticated user, you can use the special value me
.
Associates a different key pair with an existing client-side encryption identity. The updated key pair must validate against Google's S/MIME certificate profiles.
The email address of the client-side encryption identity to update.
The requester's primary email address. To indicate the authenticated user, you can use the special value me
.
Creates and uploads a client-side encryption S/MIME public key certificate chain and private key metadata for the authenticated user.
The requester's primary email address. To indicate the authenticated user, you can use the special value me
.
Turns off a client-side encryption key pair. The authenticated user can no longer use the key pair to decrypt incoming CSE message texts or sign outgoing CSE mail. To regain access, use the EnableCseKeyPair to turn on the key pair. After 30 days, you can permanently delete the key pair by using the ObliterateCseKeyPair method.
The identifier of the key pair to turn off.
The requester's primary email address. To indicate the authenticated user, you can use the special value me
.
Turns on a client-side encryption key pair that was turned off. The key pair becomes active again for any associated client-side encryption identities.
The identifier of the key pair to turn on.
The requester's primary email address. To indicate the authenticated user, you can use the special value me
.
Retrieves an existing client-side encryption key pair.
The identifier of the key pair to retrieve.
The requester's primary email address. To indicate the authenticated user, you can use the special value me
.
Lists client-side encryption key pairs for an authenticated user.
The requester's primary email address. To indicate the authenticated user, you can use the special value me
.
Deletes a client-side encryption key pair permanently and immediately. You can only permanently delete key pairs that have been turned off for more than 30 days. To turn off a key pair, use the DisableCseKeyPair method. Gmail can't restore or decrypt any messages that were encrypted by an obliterated key. Authenticated users and Google Workspace administrators lose access to reading the encrypted messages.
The identifier of the key pair to obliterate.
The requester's primary email address. To indicate the authenticated user, you can use the special value me
.
Adds a delegate with its verification status set directly to accepted
,
without sending any verification email. The delegate user must be a member
of the same Google Workspace organization as the delegator user. Gmail
imposes limitations on the number of delegates and delegators each user in
a Google Workspace organization can have. These limits depend on your
organization, but in general each user can have up to 25 delegates and up
to 10 delegators. Note that a delegate user must be referred to by their
primary email address, and not an email alias. Also note that when a new
delegate is created, there may be up to a one minute delay before the new
delegate is available for use. This method is only available to service
account clients that have been delegated domain-wide authority.
User's email address. The special value "me" can be used to indicate the authenticated user.
Removes the specified delegate (which can be of any verification status), and revokes any verification that may have been required for using it. Note that a delegate user must be referred to by their primary email address, and not an email alias. This method is only available to service account clients that have been delegated domain-wide authority.
The email address of the user to be removed as a delegate.
User's email address. The special value "me" can be used to indicate the authenticated user.
Gets the specified delegate. Note that a delegate user must be referred to by their primary email address, and not an email alias. This method is only available to service account clients that have been delegated domain-wide authority.
The email address of the user whose delegate relationship is to be retrieved.
User's email address. The special value "me" can be used to indicate the authenticated user.
Lists the delegates for the specified account. This method is only available to service account clients that have been delegated domain-wide authority.
User's email address. The special value "me" can be used to indicate the authenticated user.
Immediately and permanently deletes the specified filter.
The ID of the filter to be deleted.
User's email address. The special value "me" can be used to indicate the authenticated user.
Lists the message filters of a Gmail user.
User's email address. The special value "me" can be used to indicate the authenticated user.
Creates a forwarding address. If ownership verification is required, a
message will be sent to the recipient and the resource's verification
status will be set to pending
; otherwise, the resource will be created
with verification status set to accepted
. This method is only available
to service account clients that have been delegated domain-wide authority.
User's email address. The special value "me" can be used to indicate the authenticated user.
Deletes the specified forwarding address and revokes any verification that may have been required. This method is only available to service account clients that have been delegated domain-wide authority.
The forwarding address to be deleted.
User's email address. The special value "me" can be used to indicate the authenticated user.
Gets the specified forwarding address.
The forwarding address to be retrieved.
User's email address. The special value "me" can be used to indicate the authenticated user.
Lists the forwarding addresses for the specified account.
User's email address. The special value "me" can be used to indicate the authenticated user.
Gets the auto-forwarding setting for the specified account.
User's email address. The special value "me" can be used to indicate the authenticated user.
Gets IMAP settings.
User's email address. The special value "me" can be used to indicate the authenticated user.
Gets language settings.
User's email address. The special value "me" can be used to indicate the authenticated user.
Gets POP settings.
User's email address. The special value "me" can be used to indicate the authenticated user.
Gets vacation responder settings.
User's email address. The special value "me" can be used to indicate the authenticated user.
Creates a custom "from" send-as alias. If an SMTP MSA is specified, Gmail
will attempt to connect to the SMTP service to validate the configuration
before creating the alias. If ownership verification is required for the
alias, a message will be sent to the email address and the resource's
verification status will be set to pending
; otherwise, the resource will
be created with verification status set to accepted
. If a signature is
provided, Gmail will sanitize the HTML before saving it with the alias.
This method is only available to service account clients that have been
delegated domain-wide authority.
User's email address. The special value "me" can be used to indicate the authenticated user.
Deletes the specified send-as alias. Revokes any verification that may have been required for using it. This method is only available to service account clients that have been delegated domain-wide authority.
The send-as alias to be deleted.
User's email address. The special value "me" can be used to indicate the authenticated user.
Gets the specified send-as alias. Fails with an HTTP 404 error if the specified address is not a member of the collection.
The send-as alias to be retrieved.
User's email address. The special value "me" can be used to indicate the authenticated user.
Lists the send-as aliases for the specified account. The result includes the primary send-as address associated with the account as well as any custom "from" aliases.
User's email address. The special value "me" can be used to indicate the authenticated user.
Deletes the specified S/MIME config for the specified send-as alias.
The immutable ID for the SmimeInfo.
The email address that appears in the "From:" header for mail sent using this alias.
The user's email address. The special value me
can be used to indicate the authenticated user.
Gets the specified S/MIME config for the specified send-as alias.
The immutable ID for the SmimeInfo.
The email address that appears in the "From:" header for mail sent using this alias.
The user's email address. The special value me
can be used to indicate the authenticated user.
Insert (upload) the given S/MIME config for the specified send-as alias. Note that pkcs12 format is required for the key.
The email address that appears in the "From:" header for mail sent using this alias.
The user's email address. The special value me
can be used to indicate the authenticated user.
Lists S/MIME configs for the specified send-as alias.
The email address that appears in the "From:" header for mail sent using this alias.
The user's email address. The special value me
can be used to indicate the authenticated user.
Sets the default S/MIME config for the specified send-as alias.
The immutable ID for the SmimeInfo.
The email address that appears in the "From:" header for mail sent using this alias.
The user's email address. The special value me
can be used to indicate the authenticated user.
Updates a send-as alias. If a signature is provided, Gmail will sanitize the HTML before saving it with the alias. Addresses other than the primary address for the account can only be updated by service account clients that have been delegated domain-wide authority.
The send-as alias to be updated.
User's email address. The special value "me" can be used to indicate the authenticated user.
Sends a verification email to the specified send-as alias address. The
verification status must be pending
. This method is only available to
service account clients that have been delegated domain-wide authority.
The send-as alias to be verified.
User's email address. The special value "me" can be used to indicate the authenticated user.
Updates the auto-forwarding setting for the specified account. A verified forwarding address must be specified when auto-forwarding is enabled. This method is only available to service account clients that have been delegated domain-wide authority.
User's email address. The special value "me" can be used to indicate the authenticated user.
Updates IMAP settings.
User's email address. The special value "me" can be used to indicate the authenticated user.
Updates language settings. If successful, the return object contains the
displayLanguage
that was saved for the user, which may differ from the
value passed into the request. This is because the requested
displayLanguage
may not be directly supported by Gmail but have a close
variant that is, and so the variant may be chosen and saved instead.
User's email address. The special value "me" can be used to indicate the authenticated user.
Updates POP settings.
User's email address. The special value "me" can be used to indicate the authenticated user.
Updates vacation responder settings.
User's email address. The special value "me" can be used to indicate the authenticated user.
Stop receiving push notifications for the given user mailbox.
The user's email address. The special value me
can be used to indicate the authenticated user.
Immediately and permanently deletes the specified thread. Any messages
that belong to the thread are also deleted. This operation cannot be
undone. Prefer threads.trash
instead.
ID of the Thread to delete.
The user's email address. The special value me
can be used to indicate the authenticated user.
Gets the specified thread.
The ID of the thread to retrieve.
The user's email address. The special value me
can be used to indicate the authenticated user.
Lists the threads in the user's mailbox.
The user's email address. The special value me
can be used to indicate the authenticated user.
Modifies the labels applied to the thread. This applies to all messages in the thread.
The ID of the thread to modify.
The user's email address. The special value me
can be used to indicate the authenticated user.
Moves the specified thread to the trash. Any messages that belong to the thread are also moved to the trash.
The ID of the thread to Trash.
The user's email address. The special value me
can be used to indicate the authenticated user.
Removes the specified thread from the trash. Any messages that belong to the thread are also removed from the trash.
The ID of the thread to remove from Trash.
The user's email address. The special value me
can be used to indicate the authenticated user.