def parse_email_url(url):
    """Parses an email URL."""

    conf = {}

    url = urlparse.urlparse(url)

    # Remove query strings
    path = url.path[1:]
    path = path.split('?', 2)[0]

    # Update with environment configuration
    conf.update({
        'EMAIL_FILE_PATH': path,
        'EMAIL_HOST_USER': url.username,
        'EMAIL_HOST_PASSWORD': url.password,
        'EMAIL_HOST': url.hostname,
        'EMAIL_PORT': url.port,
    })

    if url.scheme in EMAIL_SCHEMES:
        conf['EMAIL_BACKEND'] = EMAIL_SCHEMES[url.scheme]

    if url.scheme == 'smtps':
        conf['EMAIL_USE_TLS'] = True
    else:
        conf['EMAIL_USE_TLS'] = False

    return conf
def parse_email_url ( url ) : conf = { } url = urlparse . urlparse ( url ) path = url . path [ 1 : ] path = path . split ( '?' , 2 ) [ 0 ] conf . update ( { 'EMAIL_FILE_PATH' : path , 'EMAIL_HOST_USER' : url . username , 'EMAIL_HOST_PASSWORD' : url . password , 'EMAIL_HOST' : url . hostname , 'EMAIL_PORT' : url . port , } ) if url . scheme in EMAIL_SCHEMES : conf [ 'EMAIL_BACKEND' ] = EMAIL_SCHEMES [ url . scheme ] if url . scheme == 'smtps' : conf [ 'EMAIL_USE_TLS' ] = True else : conf [ 'EMAIL_USE_TLS' ] = False return conf
Parses an email URL.