gmail.ServiceAccount

A service account sends as subject through domain-wide delegation.

Usage

Source

gmail.ServiceAccount(
    path,
    subject,
)

A Workspace administrator grants the service account’s client ID the https://www.googleapis.com/auth/gmail.send scope. Inside smtp.OAuth, it requests https://mail.google.com/ instead, so the administrator grants that.

Attributes

path: Path

The service account’s JSON key file. connect() reads it.

subject: str
The mailbox the service account acts as.