Skip to content

Instantly share code, notes, and snippets.

@diverted247
Created April 14, 2016 18:05
Show Gist options
  • Save diverted247/906b10e0ed52be0d96c647fad1a4b140 to your computer and use it in GitHub Desktop.
Save diverted247/906b10e0ed52be0d96c647fad1a4b140 to your computer and use it in GitHub Desktop.
Webhook for smtp server
# -*- coding: utf-8 -*-
import logging
import requests
from .base import Extension
log = logging.getLogger('hermes')
class Webhook(Extension):
def __call__( self , address , sender , recipients , message ):
if "[email protected]" in recipients:
email = message.split( "Return-Path: <" )[1].split( ">" )[0]
if email:
payload = { 'email' : email }
requests.post( "https://vestu.com/api/email/free/" , data=payload )
log.info( "Free for:" + email )
if "[email protected]" in recipients:
email = message.split( "Return-Path: <" )[1].split( ">" )[0]
if email:
payload = { 'email' : email }
requests.post( "https://vestu.com/api/email/vip/" , data=payload )
log.info( "VIP for:" + email )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment