Skip to content

Authentication and authorization

These functions are used to auth with the gmail API. gm_auth_configure() and gm_auth() are the most important for most users.

gm_auth()
Authorize gmailr
gm_deauth()
Clear current token
gm_auth_configure() gm_oauth_client()
Edit auth configuration
gm_scopes()
Produce scopes specific to the Gmail API
gm_has_token()
Is there a token on hand?
gm_profile()
Get info on current gmail profile
gm_token()
Produce configured token
gm_default_email() gm_default_oauth_client()
Configuring gmailr
gm_token_write() gm_token_read()
Write/read a gmailr user token

Messages

These functions create, modify, query and delete email messages.

gm_delete_message()
Permanently delete a single message
gm_id()
Get the id of a gmailr object
gm_import_message()
Import a message into the gmail mailbox from a mime message
gm_insert_message()
Insert a message into the gmail mailbox from a mime message
gm_message()
Get a single message
gm_messages()
Get a list of messages
gm_modify_message()
Modify the labels on a message
gm_send_message()
Send a message from a mime message
gm_trash_message()
Send a single message to the trash
gm_untrash_message()
Remove a single message from the trash

Threads

These functions create, modify, query and delete email threads.

gm_delete_thread()
Permanently delete a single thread.
gm_modify_thread()
Modify the labels on a thread
gm_thread()
Get a single thread
gm_threads()
Get a list of threads
gm_trash_thread()
Send a single thread to the trash
gm_untrash_thread()
Remove a single thread from the trash.

Drafts

These functions create, modify, query and delete email drafts.

gm_create_draft()
Create a draft from a mime message
gm_delete_draft()
Permanently delete a single draft
gm_draft()
Get a single draft
gm_drafts()
Get a list of drafts
gm_send_draft()
Send a draft

Labels

These functions create, modify, query and delete email labels.

gm_create_label()
Create a new label
gm_delete_label()
Permanently delete a label
gm_label()
Get a specific label
gm_labels()
Get a list of all labels
gm_update_label() gm_update_label_patch()
Update a existing label.

Attachments

These functions work with email attachments. gm_attchments() to list the attachments of a message and gm_save_attachments() are generally the most useful for most users.

gm_save_attachments()
Save attachments to a message
gm_save_attachment()
Save the attachment to a file
gm_attachments()
Retrieve information about attachments
gm_attachment()
Retrieve an attachment to a message

Email creation (MIME)

These functions are used to query or set parts of a Multipurpose Internet Mail Extensions (MIME) messages. They can be used to generate new emails from scratch.

gm_to() gm_from() gm_cc() gm_bcc() gm_date() gm_subject()
Methods to get values from message or drafts
gm_body()
Get the body text of a message or draft
gm_mime() gm_to(<mime>) gm_from(<mime>) gm_cc(<mime>) gm_bcc(<mime>) gm_subject(<mime>) gm_text_body() gm_html_body() gm_attach_part() gm_attach_file()
Create a mime formatted message object
as.character(<mime>)
Convert a mime object to character representation

Miscellaneous tools

These functions don’t fit neatly into the above categories and are generally used internally or for debugging.

gm_history()
Retrieve change history for the inbox
gm_last_response()
Response from the last query
quoted_printable_encode()
Encode text using quoted printable