Gmail

You can create tasks from e-mails in your Gmail account using the gmail service name.

Additional Dependencies

Install packages needed for Gmail support with:

pip install bugwarrior[gmail]

Client Secret

In order to use this service, you need to create a product and download a client secret file. Do this by following the instructions on: https://developers.google.com/gmail/api/quickstart/python. You should save the resulting secret in your home directory as .gmail_client_secret.json. You can override this location by setting the client_secret_path option.

Example Service

Here’s an example of a gmail target:

[my_gmail]
service = gmail
gmail.query = label:action OR label:readme
gmail.login_name = you@example.com
[my_gmail]
service = "gmail"
query = "label:action OR label:readme"
login_name = "you@example.com"

The specified query can be any gmail search term. By default it will select starred threads. One task is created per selected thread, not per e-mail.

You do not need to specify the login_name, but it can be useful to avoid accidentally fetching data from the wrong account. (This also allows multiple targets with the same login to share the same authentication token.)

Thread Limit

Gmail search results are capped at 100 max results by default, but may be adjusted to meet your needs by specifying email_limit:

gmail.thread_limit = 1000
thread_limit = "1000"

Authentication

When you first run bugwarrior pull, a browser will be opened and you’ll be asked to authorise the application to access your e-mail. Once authorised a token will be stored in your bugwarrior data directory.

Note

A limitation of the current implementation is that the browser must be available on the same machine as bugwarrior is invoked from. This precludes usage of the gmail service on a headless server.

Provided UDA Fields

Field Name

Description

Type

gmaillabels

GMail labels

Text (string)

gmaillastmessageid

Last RFC2822 Message-ID

Text (string)

gmaillastsender

GMail last sender name

Text (string)

gmaillastsenderaddr

GMail last sender address

Text (string)

gmailsnippet

GMail snippet

Text (string)

gmailsubject

GMail Subject

Text (string)

gmailthreadid

GMail Thread Id

Text (string)

gmailurl

GMail URL

Text (string)