{"id":26658840,"url":"https://github.com/denisecase/dc-mailer","last_synced_at":"2025-04-11T14:09:34.804Z","repository":{"id":97697826,"uuid":"600239187","full_name":"denisecase/dc-mailer","owner":"denisecase","description":"Send an email using Python","archived":false,"fork":false,"pushed_at":"2025-02-04T04:22:57.000Z","size":35,"stargazers_count":0,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T10:17:00.234Z","etag":null,"topics":["alerts","data","email","python","streaming"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/dc-mailer/","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/denisecase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2023-02-10T22:38:40.000Z","updated_at":"2025-02-04T04:22:55.000Z","dependencies_parsed_at":"2025-02-03T06:25:43.213Z","dependency_job_id":null,"html_url":"https://github.com/denisecase/dc-mailer","commit_stats":null,"previous_names":["denisecase/dc-mailer","denisecase/email-alert"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denisecase%2Fdc-mailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denisecase%2Fdc-mailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denisecase%2Fdc-mailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denisecase%2Fdc-mailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denisecase","download_url":"https://codeload.github.com/denisecase/dc-mailer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248413683,"owners_count":21099341,"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":["alerts","data","email","python","streaming"],"created_at":"2025-03-25T10:17:03.760Z","updated_at":"2025-04-11T14:09:34.784Z","avatar_url":"https://github.com/denisecase.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dc-mailer\n\n\u003e Send an email alert using Python and Gmail\n\n## Requirements\n\n- Python 3.11+ (required for reading toml files)\n- A configured Gmail Account (see below)\n\n---\n\n## Step 1. Install this Module\n\nRun\n\n```\npip install dc-mailer\n```\n\nOr: add `dc-mailer` to requirements.txt and install. \n\n---\n\n## Step 2. Configure Application Settings\n\n### Local Development\nFor local development, we can configure our settings with a file.\nFirst, add .env.toml to .gitignore to keep it from being published.\nThen, create a .env.toml file in your project directory with the following.\n```\noutgoing_email_host = \"smtp.gmail.com\"\noutgoing_email_port = 587\noutgoing_email_address = \"youremail@gmail.com\"\noutgoing_email_password = \"aaaabbbbccccdddd\"\n```\n\n### GitHub Action Deployments\nIn a deployment environment like GitHub Actions, the .env.toml file won't be available. Instead, you'll need to set the configuration variables as environment variables.\n\nFirst, add the following secrets to your GitHub repository:\n\n1. Navigate to your repository on GitHub.\n2. Click on Settings \u003e Secrets and variables \u003e Actions.\n3. Click on New repository secret and add the following secrets:\n    - OUTGOING_EMAIL_HOST: Set this to \"smtp.gmail.com\".\n    - OUTGOING_EMAIL_PORT: Set this to 587.\n    - OUTGOING_EMAIL_ADDRESS: Set this to your email address (e.g., \"your-email@gmail.com\").\n    - OUTGOING_EMAIL_PASSWORD: Set this to your application password.\n\nNext, reference these secrets in your GitHub Actions workflow. \nFor an example, see [this deploy.yml](https://github.com/denisecase/kafka-producer-earthquake/blob/main/.github/workflows/deploy.yml).\n\n---\n\n## Step 3. Configure Gmail \n\nEnable IMAP\n\n - Open Gmail. Click Settings or ⚙️ in the top-right.\n - Click \"See all settings\". Navigate to \"Forwarding and POP/IMAP\".\n - Under \"IMAP access\", select \"Enable IMAP\" and save changes.\n\nGenerate an App Password\n\n- If you have 2-Step Verification enabled, create an app password for \"dc-mailer\".\n- Copy the 16-character password displayed.\n- Paste the 16-char as your password in .env.toml file. Remove spaces.\n- For detailed instructions, refer to [Google's support page](https://support.google.com/accounts/answer/185833?hl=en).\n\n---\n\n## Step 4. Import and Use in a Python Script\n\nOnce installed and your .env.toml file is ready, you can use it in your code. \n\n```python\nfrom dc_mailer import send_mail\n\ntitle = \"Email from Data Analyst and Python Developer\"\ncontent = \"Did you know the Python standard library enables emailing?\"\nrecipient = \"youremail@gmail.com\"\n\ntry:\n    send_mail(subject=title, body=content, recipient=recipient)\n    print(\"SUCCESS: Email sent.\")\nexcept RuntimeError as e:\n    print(f\"ERROR: Sending failed: {e}\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenisecase%2Fdc-mailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenisecase%2Fdc-mailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenisecase%2Fdc-mailer/lists"}