How to set up SMTP Server for Airflow Email alerts using Gmail

In my airflow.cfg, I have configured as follows

smtp_host = smtp.gmail.com
smtp_starttls = True
smtp_ssl = False
smtp_user = "#########@gmail.com"
smtp_password = "######"
smtp_port = 587
smtp_mail_from = "#######@gmail.com"
smtp_timeout = 30
smtp_retry_limit = 5

The problem is, the email is not being sent. For the smtp_password, i have tried both the App password and the actual password for the email. Both don't work. Below is my airflow dag

# default arguments
default_args = {
    'owner': 'Airflow',
    'depends_on_past': False,
    'start_date': days_ago(0)
    'email_on_retry': True,
    'retries': 1,
    'retry_delay': timedelta(minutes=0.5)
}

# initializing dag
dag = DAG(
    'test_email',
    default_args=default_args,
    catchup=False,
    schedule_interval=timedelta(minutes=1),
    max_active_runs=1
)


def throw_error(**context):
    raise ValueError('Intentionally throwing an error to send an email.')


t1 = PythonOperator(task_id='throw_error_and_email',
                    python_callable=throw_error,
                    provide_context=True,
                    email_on_failure=True,
                    email='######@gmail.com',
                    dag=dag)

t1

Log Error

[2021-09-23 09:20:03,914] {configuration.py:356} WARNING - section/key [smtp/smtp_user] not found in config [2021-09-23 09:20:03,914] {email.py:184} INFO - Email alerting: attempt 1

[2021-09-23 09:20:03,918] {taskinstance.py:1509} ERROR - Failed to send email to: [2021-09-23 09:20:03,918] {taskinstance.py:1510} ERROR - [Errno 99] Cannot assign requested address

What I'm I missing?

NB Airflow is running on docker

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum