Package: email-service
Python package to quickly integrate different email services with your Application with just 3 lines of code.Send Your email without caring about the backend code.GitHub:ramanaditya/email-servicePyPI:pypi.org/project/email-serviceUsageInstall it with pip$pipinstallemail-serviceEmail IntegrationSave theAPI_KEYin the.envfile asSENDGRID_API_KEY=api_keyImport EmailHandler>>>fromemail_service.email_handlerimportEmailHandlerForm the dictionary of datadata={"from_email":"Name WithSpace <from_email@gmail.com>",# Required"subject":"This is the test for the Individual email",# Required"reply_to_addresses":"email1@gmail.com","html_body":"<h1>Email Template for Individual email</h1>",# Either of html_body or text_body is required"text_body":"Email Template for Individual email","to_for_bulk":[{"name":"Name","email":"email@gmail.com"},],# Required for Bulk Email"recipients":{"to":[{"name":"name1","email":"email1@gmail.com"},],# Required"cc":[{"name":"name2","email":"email2@google.com"},],"bcc":[{"name":"name3","email":"email3@google.com"},],},"attachments":["file_path (pdf)","calender invite (ics)","image_path (png/jpg/jpeg)"]}Send the email>>># For Individual Email>>>send_email=EmailHandler()>>># For Bulk Email>>>send_email=EmailHandler(email_type="BULK")Sendgrid Integration>>># Send it using sendgrid>>>response=send_email.sendgrid(data)Responsestatus_code:202:OK,400:Errormessage:Error or Success MessageDevelopmentSetupClone the repository$gitclonehttps://github.com/ramanaditya/email-serviceCreate a virtual environment using virtualenv or venv.$python-mvenvvenv$sourcevenv/bin/activateUpgrade pip$python-mpipinstall--upgradepipInstall python packages$python-mpipinstall-rrequirements.txtGit FlowCreate new Branch fromdevelopbranch$gitcheckout-bdeveloporigin/develop$gitcheckout-bfeature_branchPush the Code$gitaddfile_which_was_changed$gitcommit-m"Commit Message"$gitpush-uoriginfeature_branchBuild Package for Local Testing$# Build the package$pythonsetup.pybuild$# Install the package$pythonsetup.pyinstallPyPIThis is just for the reference and need not to be run,
If you want to run these scripts, please take a note of thisFor testing, we maintain the test package attestpypiPyPI or Test PyPI, does not accept same file name, you can change the file name or version in the./setup.pyYou will be prompted to enterEither username and passwordor, username as “__token__” and password as token (can be generated from the pypi website)It will be uploaded to your pypi or testpypi accountGenerating distribution archives$# Downloading latest version of setuptools$python-mpipinstall--user--upgradesetuptoolswheel$pythonsetup.pysdistbdist_wheelUploading to Test PyPI$# Upload to Test PyPI https://test.pypi.org/$python-mtwineupload--repositorytestpypidist/*Download the package from Test PyPI$python-mpipinstall-ihttps://test.pypi.org/simple/email-serviceCheck against the code$# Edit the file inside /example to have some valid data$# export SENDGRID_API_KEY before running the script$pythonindividual_email.py# For individual email$pythonbulk.py# For bulk emailUploading to PyPI$# Upload to PyPI https://pypi.org/$python-mtwineuploaddist/*Download the package from Test PyPI$python-mpipinstall-ihttps://test.pypi.org/simple/email-serviceIssuesIssue No.IssueNOTE:Feel free toopen issues. Make sure you follow the Issue Template provided.Contribution GuidelinesWrite clear meaningful git commit messages (Do readthis).Make sure your PR’s description contains GitHub’s special keyword references that automatically close the related issue when the PR is merged. (Checkthisfor more info)When you make very very minor changes to a PR of yours (like for example fixing a text in button, minor changes requested by reviewers) make sure you squash your commits afterward so that you don’t have an absurd number of commits for a very small fix. (Learn how to squash athere)Please follow thePR Templateto create the PR.Always open PR todevelopbranch.Please read ourCode of Conduct.Referthisfor more.If you❤️thisrepository, support it by star 🌟