{"id":17552563,"url":"https://github.com/iloveitaly/gmail-draft-creator","last_synced_at":"2025-08-26T22:20:57.722Z","repository":{"id":178679039,"uuid":"662218569","full_name":"iloveitaly/gmail-draft-creator","owner":"iloveitaly","description":"Simple tool to take a CSV and a template and create drafts in your Gmail. Can be used as a command line tool, or as a library.","archived":false,"fork":false,"pushed_at":"2025-03-02T13:01:24.000Z","size":155,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T16:54:27.511Z","etag":null,"topics":["email","gmail","gmail-api"],"latest_commit_sha":null,"homepage":"https://github.com/iloveitaly/gmail-draft-creator","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iloveitaly.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["iloveitaly"]}},"created_at":"2023-07-04T16:01:25.000Z","updated_at":"2025-03-02T13:01:21.000Z","dependencies_parsed_at":"2024-06-20T22:28:51.447Z","dependency_job_id":"ca8734d4-f19d-423c-b22b-5f6220a84d3a","html_url":"https://github.com/iloveitaly/gmail-draft-creator","commit_stats":null,"previous_names":["iloveitaly/gmail-draft-creator"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iloveitaly%2Fgmail-draft-creator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iloveitaly%2Fgmail-draft-creator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iloveitaly%2Fgmail-draft-creator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iloveitaly%2Fgmail-draft-creator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iloveitaly","download_url":"https://codeload.github.com/iloveitaly/gmail-draft-creator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250545537,"owners_count":21448225,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["email","gmail","gmail-api"],"created_at":"2024-10-21T05:43:12.328Z","updated_at":"2025-04-24T01:41:32.762Z","avatar_url":"https://github.com/iloveitaly.png","language":"Python","readme":"# Gmail Drafter: Create Mail Merge Drafts\n\nSimple tool to take a CSV and a template and create drafts in your Gmail. Useful for sending emails to large-ish numbers\nof people where you want to slightly customize the emails for each user. You can quickly run through drafts, customize it, and send.\n\n## Installation\n\n```shell\npip install -U gmail-draft-creator\n```\n\n## Usage\n\n```shell\nUsage: gmail-draft-creator [OPTIONS]\n\nOptions:\n  --csv PATH       Path to the CSV file.  [required]\n  --template PATH  Path to the template file.  [required]\n  --subject TEXT   Subject for the email drafts.\n  --dry-run        Run script without creating drafts.\n  --help           Show this message and exit.\n```\n\nYou can also import the `create_draft` function and use it in your own scripts.\n\n### CSV Files\n\nMust contain an `email` column (case insensitive).\n\nEach column in the CSV is passed as a parameter to the provided template. The column name is stripped of whitespace, lowercased, and stripped all non-alpha characters. For example, a column named `First Name` would be passed as `$firstname` in the template.\n\n#### Example CSV File\n\nA CSV file that would work with this template might be something like this:\n\n```csv\nEmail,Name,Reason,OtherColumn\njoe@test.com,Joe,reminder\njeff@email.com,Jeff,sales pitch\n```\n\n### Template Files\n\nYou can include subject line and variables in the template file:\n\n```text\nSubject: Hello $NAME\n\nHi, here's another ${REASON} why I'm emailing you.\n```\n\n## Setup\n\nYou need to create a \"OAuth 2.0 Client IDs\" which has to be done with a Google Workspace (gsuite). This will not work on a personal gmail account (unless you create a app on a workspace and add your personal account as a test account).\n\n### Generating a Gmail API Token\n\n1. Navigate to the Google Cloud Console. https://console.developers.google.com/\n2. Create a new project or select an existing one.\n3. Go to \"APIs \u0026 Services\" -\u003e \"Library\" and enable the Gmail API.\n4. Navigate to \"APIs \u0026 Services\" -\u003e \"Credentials\".\n5. Click \"Create Credentials\" -\u003e \"OAuth client ID\".\n6. Select \"Desktop app\" as the application type, then click \"Create\".\n7. Download the JSON file, rename it to `credentials.json`, and place it in the root of this project.\n8. Run the script and oauth into your account\n\nIf you want to edit scopes on an existing application, you can:\n\n1. OAuth Consent Screen\n2. Edit\n3. Continue to step 2\n4. Add or remove scopes\n5. Add scopes and save\n\n#### Credential Scopes Needed\n\nTwo main scopes are required for this:\n\n* `https://www.googleapis.com/auth/gmail.compose`\n* `https://www.googleapis.com/auth/gmail.readonly`\n\nSome other scopes I'd add so you can reuse the credentials in other projects, [like gmailctl](https://github.com/mbrt/gmailctl) or calendar scripts:\n\n* `https://www.googleapis.com/auth/calendar.readonly`\n* `https://www.googleapis.com/auth/calendar.event`\n* `https://www.googleapis.com/auth/gmail.labels`\n* `https://www.googleapis.com/auth/gmail.settings.basic`\n\n## TODO\n\n- [ ] add credentials as a command line argument\n- [ ] add serialized token as a CLI argument\n","funding_links":["https://github.com/sponsors/iloveitaly"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filoveitaly%2Fgmail-draft-creator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filoveitaly%2Fgmail-draft-creator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filoveitaly%2Fgmail-draft-creator/lists"}