How to use the yagmail.error.YagInvalidEmailAddress function in yagmail

To help you get started, we’ve selected a few yagmail examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kootenpv / yagmail / yagmail / validate.py View on Github external
def validate_email_with_regex(email_address):
    """
    Note that this will only filter out syntax mistakes in emailaddresses.
    If a human would think it is probably a valid email, it will most likely pass.
    However, it could still very well be that the actual emailaddress has simply
    not be claimed by anyone (so then this function fails to devalidate).
    """
    if not re.match(VALID_ADDRESS_REGEXP, email_address):
        emsg = 'Emailaddress "{}" is not valid according to RFC 2822 standards'.format(
            email_address)
        raise YagInvalidEmailAddress(emsg)
    # apart from the standard, I personally do not trust email addresses without dot.
    if "." not in email_address and "localhost" not in email_address.lower():
        raise YagInvalidEmailAddress("Missing dot in emailaddress")
github kootenpv / yagmail / yagmail / validate.py View on Github external
def validate_email_with_regex(email_address):
    """
    Note that this will only filter out syntax mistakes in emailaddresses.
    If a human would think it is probably a valid email, it will most likely pass.
    However, it could still very well be that the actual emailaddress has simply
    not be claimed by anyone (so then this function fails to devalidate).
    """
    if not re.match(VALID_ADDRESS_REGEXP, email_address):
        emsg = 'Emailaddress "{}" is not valid according to RFC 2822 standards'.format(
            email_address)
        raise YagInvalidEmailAddress(emsg)
    # apart from the standard, I personally do not trust email addresses without dot.
    if "." not in email_address and "localhost" not in email_address.lower():
        raise YagInvalidEmailAddress("Missing dot in emailaddress")