Skip to main content

README

Continuous Integration codecov

Send an email and perform an action when a user responds with one of a set of keywords.

This currently has been tested using Gmail as a less secure app.

Features

  • Runs a callback function if the email reply is a keyword
  • Email the replier saying no keyword was found if the reply email doesn't contain a keyword
  • Check if an email has been replied to

Usage

pip install email-keyword-matcher
from email_keyword_matcher import EmailKeywordMatcher
import time

host = 'smtp.gmail.com'
port = 567
sender_email = 'foo@bar.com'
receiver_email = 'bar@baz.com'
password = 'super-secret-password'

# Create an `EmailKeywordMatcher` object
#
# Note if you don't pass in credentials, you will be prompted
# for them
ekm = EmailKeywordMatcher(sender_email, password, host, port)

# Create keywords that will be looked for in the reply
# and associate a callback with them
ekm.add_keyword('done', lambda: print("'done' called"))
ekm.add_keyword('snooze', lambda: print("'snooze' called"))
ekm.add_keyword('cancel', lambda: print("'cancel' called"))

# Send and email
email_subject = "Checkin"
email_content = "Make sure to checkin"
ekm.send(receiver_email, email_subject, email_content)

# Check if that email has been replied to
while not ekm.is_response(receiver_email, email_subject):
    print("No email back yet")
    time.sleep(5)

# Perform the callback for the found keyword, or
# send another email to `receiver_email` saying that
# a valid keyword was not found.
ekm.process_received(receiver_email, email_subject)

Meta

Audrow Nash - @audrow - audrow@hey.com

Distributed under the MIT license. See LICENSE.txt for more information.

https://github.com/audrow/email-keyword-matcher

Release files for email-keyword-matcher 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for email-keyword-matcher 1.0.0
File Size Uploaded
email-keyword-matcher-1.0.0.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for email-keyword-matcher 1.0.0
File Interpreter ABI Platform
email_keyword_matcher-1.0.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 9.4 kB

Release files / email-keyword-matcher-1.0.0.tar.gz

Download URL email-keyword-matcher-1.0.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1023345eeebb28c0fda1e015cf68e7f7d31324d8503e18fda38dae649c308b06
BLAKE2b-256 checksum
How to use checksums
38aff4a66d29dd0faf5d22f80e7f6bc0f90bd9adf0c198020c754b7c291eb514
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

Release files / email_keyword_matcher-1.0.0-py2.py3-none-any.whl

Download URL email_keyword_matcher-1.0.0-py2.py3-none-any.whl
Size 4.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
6ae5032478decf75a27cbc1428bbc877a402349844b80b06ca18def02794166a
BLAKE2b-256 checksum
How to use checksums
6b4980a3dc242baed1975660f64901cc1e368d6961956a3cf5cf693a17788615
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page