Created
April 14, 2016 18:05
-
-
Save diverted247/906b10e0ed52be0d96c647fad1a4b140 to your computer and use it in GitHub Desktop.
Webhook for smtp server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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