Mailgun Flanker电子邮件验证无效

时间:2016-02-18 11:08:38

标签: mailgun

您好我想验证电子邮件地址,我找到了mailgun侧卫电子邮件验证python库,但它无效。

>>> from flanker.addresslib import address
>>>
>>> address.validate_address('foo@mailgun.com')
None

请帮助我!

由于

2 个答案:

答案 0 :(得分:0)

最好使用mailgun api validor,例如。

def get_validate():
return requests.get(
    "https://api.mailgun.net/v3/address/validate",
    auth=("api", "pubkey-5ogiflzbnjrljiky49qxsiozqef5jxp7"),
    params={"address": "foo@mailgun.net"}

答案 1 :(得分:0)

示例:https://github.com/diegovalle/crimenmexico/blob/master/api/forms.py

view.py:

def get_validate(email):
    return requests.get(
            "https://api.mailgun.net/v3/address/validate",
            auth=("api", "pubkey-f387c7feae844803cdda9c99d4b976cb"),
            params={'address': email})


rq = get_validate(email)
if rq is not None:
    data_email = rq.json()
    if data_email['is_valid'] == False:
        if data_email['did_you_mean'] is not None:
            print("Error, Wrong Email")
        else:
            print("Error, Wrong Email")
    else:
        print("Ok, Email Correct")