ecerulm opened a new issue #17930:
URL: https://github.com/apache/airflow/issues/17930


   ### Apache Airflow version
   
   main (development)
   
   ### Operating System
   
   macOsS
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-amazon (main)
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   _No response_
   
   ### What happened
   
   
https://github.com/apache/airflow/blob/098765e227d4ab7873a2f675845b50c633e356da/airflow/providers/amazon/aws/utils/emailer.py#L40-L41
   
   ```
       hook.send_email(
           mail_from=None,
           to=to,
           subject=subject,
           html_content=html_content,
           files=files,
           cc=cc,
           bcc=bcc,
           mime_subtype=mime_subtype,
           mime_charset=mime_charset,
       )
   ```
   
   the `mail_from=None` will trigger an error when sending the mail, when using 
AWS Simple Email Service you  need to provide a from address and has to be 
already verified in AWS SES >  "Verified identities"
   
   
   
   
   
   ### What you expected to happen
   
   I expected it to send a mail but it doesn't because 
   
   ### How to reproduce
   
   _No response_
   
   ### Anything else
   
   This is easily solved by providing a from address like in: 
   ```
       smtp_mail_from = conf.get('smtp', 'SMTP_MAIL_FROM')
       hook.send_email(
           mail_from=smtp_mail_from,
   ```
   
   the problem is: Can we reuse the smtp.SMTP_MAIL_FROM or do we need to create 
a new configuration parameter like email.email_from_address ? 
   
      * smtp uses its own config smtp.smtp_mail_from
      * sendgrid uses an environment variable `SENDGRID_MAIL_FROM` 
(undocumented by the way) 
     
   
   So, my personal proposal is to
   * introduce an email.email_from_email and email.email_from_name 
   * read those new configuration parameters at 
[utils.email.send_email](https://github.com/apache/airflow/blob/098765e227d4ab7873a2f675845b50c633e356da/airflow/utils/email.py#L50-L67
 ) 
   * pass those as arguments to the backend (kwargs `from_email`, `from_name`) 
. the [sendgrid backend can already read those  
](https://github.com/apache/airflow/blob/098765e227d4ab7873a2f675845b50c633e356da/airflow/providers/sendgrid/utils/emailer.py#L70-L71)
 although seems unused at the momemt.
   
   
   
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to