{"id":16431791,"url":"https://github.com/drkostas/pyemail-sender","last_synced_at":"2025-03-23T08:31:39.863Z","repository":{"id":57455906,"uuid":"453143542","full_name":"drkostas/pyemail-sender","owner":"drkostas","description":"A utility for sending emails with attachments. Currently only Gmail is supported.","archived":false,"fork":false,"pushed_at":"2022-01-30T01:42:25.000Z","size":33,"stargazers_count":20,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T12:11:28.277Z","etag":null,"topics":["email","email-sender","emailer","gmail","gmail-api","gmailer"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/pyemail-sender/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drkostas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-28T16:44:08.000Z","updated_at":"2024-12-29T09:25:43.000Z","dependencies_parsed_at":"2022-09-02T08:31:59.694Z","dependency_job_id":null,"html_url":"https://github.com/drkostas/pyemail-sender","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drkostas%2Fpyemail-sender","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drkostas%2Fpyemail-sender/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drkostas%2Fpyemail-sender/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drkostas%2Fpyemail-sender/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drkostas","download_url":"https://codeload.github.com/drkostas/pyemail-sender/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245078067,"owners_count":20557274,"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","email-sender","emailer","gmail","gmail-api","gmailer"],"created_at":"2024-10-11T08:32:35.390Z","updated_at":"2025-03-23T08:31:39.584Z","avatar_url":"https://github.com/drkostas.png","language":"Python","funding_links":["https://www.buymeacoffee.com/drkostas"],"categories":[],"sub_categories":[],"readme":"# Python Emailer\n\n[![Downloads](https://static.pepy.tech/personalized-badge/pyemail-sender?period=total\u0026units=international_system\u0026left_color=grey\u0026right_color=red\u0026left_text=Downloads)](https://pepy.tech/project/pyemail-sender)\n[![GitHub license](https://img.shields.io/badge/license-Apache-blue.svg)](https://github.com/drkostas/pyemail-sender/master/LICENSE)\n[![CircleCI](https://circleci.com/gh/drkostas/pyemail-sender/tree/master.svg?style=svg)](https://circleci.com/gh/drkostas/pyemail-sender/tree/master)\n\n## About \u003ca name = \"about\"\u003e\u003c/a\u003e\n\nA utility for sending emails with attachments. Currently only Gmail \nis supported. [PYPI Package](https://pypi.org/project/pyemail-sender/)\n\n## Table of Contents\n\n+ [Using the library](#using)\n    + [Installing and using the library](#install_use)\n    + [Examples of usage](#examples)\n+ [Manually install the library](#manual_install)\n    + [Prerequisites](#prerequisites)\n    + [Install the requirements](#installing_req)\n    + [Run the Unit Tests](#unit_tests)\n+ [Continuous Integration](#ci)\n+ [Update PyPI package](#pypi)\n+ [License](#license)\n\n## Using the library \u003ca name = \"using\"\u003e\u003c/a\u003e\n\nFor a detailed usage example see \n[example.py](https://github.com/drkostas/pyemail-sender/master/example.py).\n\nYou will need an application-specific password for your Google account. \n[Reference 1](https://support.google.com/mail/?p=InvalidSecondFactor), \n[Reference 2](https://security.google.com/settings/security/apppasswords)\n\n### Installing and using the library \u003ca name = \"install_use\"\u003e\u003c/a\u003e\n\nFirst, you need to install the library using pip:\n\n```shell\n$ pip install pyemail_sender\n```\n\nThen, import it and initialize it like so:\n\n```python\nfrom pyemail_sender import GmailPyEmailSender\n\nemail_conf = {'type': 'gmail',\n              'config': {'api_key': 'your api key', 'email_address': 'youremail@gmail.com'}}\npymail = GmailPyEmailSender(config=email_conf)\n```\n\nIf you want to use a yml file to load the configuration, you can use the `PyEmailSenderConfig` class:\n```python\nfrom pyemail_sender import PyEmailSenderConfig\nimport os\n\nconfig_path = str(os.path.join('confs', 'conf.yml'))\nconfig = PyEmailSenderConfig(config_src=config_path)\nemail_conf = config.get_pyemail_sender_config()\n```\n\nTwo example YAML files can be found in \nthe [confs folder](https://github.com/drkostas/pyemail-sender/blob/master/confs).\nFor more details on how to use this YAML configuration loader see \nthis [Readme](https://github.com/drkostas/yaml-config-wrapper/blob/master/README.md).\n\n### Examples of usage \u003ca name = \"examples\"\u003e\u003c/a\u003e\n\n\n**Send Simple Email**\n```python\npymail.send_email(subject='A simple email',\n                  to=[email_conf['email_address']],\n                  text='Email body text goes here')\n```\n**Send HTML Email**\n```python\npymail.send_email(subject='A simple HTML email',\n                  to=[email_conf['email_address']],\n                  html='\u003ch1\u003eEmail body with HTML goes here\u003c/h1\u003e')\n```\n**Send Email with all the arguments**\n```python\npymail.send_email(subject='Email with all possible arguments',\n                  sender=email_conf['email_address'],\n                  to=[email_conf['email_address']],\n                  cc=[email_conf['email_address']],\n                  bcc=[email_conf['email_address']],\n                  reply_to=email_conf['email_address'],\n                  html='\u003ch1\u003eTest \u003cb\u003eHTML\u003c/b\u003e body\u003c/h1\u003e',\n                  attachments=['my_file.txt'])\n```\n\nAll of these examples can be found \nin [example.py](https://github.com/drkostas/pyemail-sender/tree/blob/master/example.py).\n\n## Manually install the library \u003ca name = \"manual_install\"\u003e\u003c/a\u003e\n\nThese instructions will get you a copy of the project up and running on your local machine for\ndevelopment and testing purposes.\n\n### Prerequisites \u003ca name = \"prerequisites\"\u003e\u003c/a\u003e\n\nYou need to have a machine with\n[anaconda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html) installed and\nany Bash based shell (e.g. zsh) installed.\n\n```ShellSession\n\n$ conda -V\nconda 4.10.1\n\n$ echo $SHELL\n/usr/bin/zsh\n\n```\n\n### Install the requirements \u003ca name = \"installing_req\"\u003e\u003c/a\u003e\n\nAll the installation steps are being handled by\nthe [Makefile](https://github.com/drkostas/pyemail-sender/blob/master/Makefile).\n\nFirst, modify the python version (`min_python`) and everything else you need in\nthe [settings.ini](https://github.com/drkostas/pyemail-sender/blob/master/settings.ini).\n\nThen, execute the following commands:\n\n```ShellSession\n$ make create_env\n$ conda activate pyemail_sender\n$ make dist\n```\n\nNow you are ready to use and modify the library.\n\n### Run the Unit Tests \u003ca name = \"unit_tests\"\u003e\u003c/a\u003e\n\nIf you want to run the unit tests, execute the following command:\n\n```ShellSession\n$ make tests\n```\n\n## Continuous Integration \u003ca name = \"ci\"\u003e\u003c/a\u003e\n\nFor the continuous integration, the \u003cb\u003eCircleCI\u003c/b\u003e service is being used. For more information you can\ncheck the [setup guide](https://circleci.com/docs/2.0/language-python/).\n\nFor any modifications, edit\nthe [circleci config](https://github.com/drkostas/pyemail-sender/blob/master/.circleci/config.yml).\n\n## Update PyPI package \u003ca name = \"pypi\"\u003e\u003c/a\u003e\n\nThis is mainly for future reference for the developers of this project. First,\ncreate a file called `~/.pypirc` with your pypi login details, as follows:\n\n```\n[pypi]\nusername = your_pypi_username\npassword = your_pypi_password\n```\n\nThen, modify the python version (`min_python`), project status (`status`), release version (`version`) \nand everything else you need in\nthe [settings.ini](https://github.com/drkostas/pyemail-sender/blob/master/settings.ini).\n\nFinally, execute the following commands:\n\n```ShellSession\n$ make create_env\n$ conda activate pyemail_sender\n$ make release\n```\n\nFor a dev release, change the `testing_version` and instead of `make release`, run `make release_test`.\n\n## License \u003ca name = \"license\"\u003e\u003c/a\u003e\n\nThis project is licensed under the Apache License - see\nthe [LICENSE](https://github.com/drkostas/pyemail-sender/blob/master/LICENSE) file for details.\n\n\u003ca href=\"https://www.buymeacoffee.com/drkostas\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy Me A Coffee\" height=\"41\" width=\"174\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrkostas%2Fpyemail-sender","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrkostas%2Fpyemail-sender","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrkostas%2Fpyemail-sender/lists"}