How can we send the customized sendmail what all configurations are required

Mine Airflow version is 2.5 and its installed on EC2 Ubuntu.

I know the emailoperator is there to send the mail, but we need a customized email function from python to send across the notification based on the event: (failure, success)

How can I use the smtplib of python to send the mails, without configuring the airflow.cfg for the required smtp, where the variables needs to be declared below variables:

AIRFLOW__SMTP__SMTP_HOST=smtp.sendgrid.net
AIRFLOW__SMTP__SMTP_STARTTLS=False
AIRFLOW__SMTP__SMTP_SSL=False
AIRFLOW__SMTP__SMTP_USER=apikey
AIRFLOW__SMTP__SMTP_PASSWORD=
AIRFLOW__SMTP__SMTP_PORT=587
AIRFLOW__SMTP__SMTP_MAIL_FROM=

Any good reference with proper steps