erinforman opened a new issue, #59380:
URL: https://github.com/apache/airflow/issues/59380

   ### Apache Airflow version
   
   3.1.4 (also affects 3.0.x, 3.1.x)
   
   ### What happened?
   
   The configuration option `default_email_on_failure` (and 
`default_email_on_retry`) is documented in the [Configuration 
Reference](https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html)
 and present in the config template, but the Airflow 3 SDK does not read this 
value.
   
   **Configuration (documented and present in config template):**
   ```yaml
   # config_templates/config.yml
   default_email_on_failure:
     description: |
       Whether email alerts should be sent when a task failed
     version_added: 2.0.0
     type: boolean
     default: "True"
   ```
   
   **SDK behavior (ignores config):**
   ```python
   # airflow/sdk/bases/operator.py - Line 217
   OPERATOR_DEFAULTS: dict[str, Any] = {
       "email_on_failure": True,  # Hardcoded, does not read from config
       "email_on_retry": True,
   }
   ```
   
   **Airflow 2.x behavior (read from config):**
   ```python
   # airflow/models/baseoperator.py
   email_on_failure: bool = conf.getboolean("email", 
"default_email_on_failure", fallback=True)
   ```
   
   ### What you think should happen instead?
   
   One of the following:
   
   1. **Option A (Preferred):** The SDK should read the config value like 
Airflow 2.x did, maintaining backward compatibility for users who set these 
configs.
   
   2. **Option B:** If the config is intentionally no longer used, it should be 
marked as deprecated in the configuration reference and config template, with a 
note directing users to set `email_on_failure` explicitly in `default_args` 
instead.
   
   Currently there's an inconsistency:
   - The **operator parameters** (`email`, `email_on_failure`) are deprecated 
with warnings pointing to `SmtpNotifier` (PR #47146)
   - The **config options** (`default_email_on_failure`) are still documented 
without deprecation notices, but are silently ignored
   
   ### How to reproduce
   
   1. Set environment variable:
      ```bash
      export AIRFLOW__EMAIL__DEFAULT_EMAIL_ON_FAILURE=False
      ```
   
   2. Create a DAG with `email` set but no explicit `email_on_failure`:
      ```python
      default_args = {
          "email": ["[email protected]"],
          # email_on_failure not set - should inherit from config
      }
      ```
   
   3. Trigger a task failure
   
   4. **Expected (Airflow 2.x behavior):** No email sent (config is `False`)
   5. **Actual (Airflow 3.x behavior):** Email attempted (SDK hardcodes `True`)
   
   ### Operating System
   
   Linux / macOS
   
   ### Versions of Apache Airflow Providers
   
   N/A - core issue
   
   ### Deployment
   
   Docker-Compose, Kubernetes (Helm)
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   **Related:**
   - PR #47146 deprecated the operator parameters but didn't address the config 
options
   - The mailing list discussion "[DISCUSS] Drop email integration from Airflow 
Core" focused on operator-level changes
   
   **Workaround:** Explicitly set `email_on_failure=False` in `default_args`:
   ```python
   default_args = {
       "email": ["[email protected]"],
       "email_on_failure": False,  # Must be explicit in Airflow 3
   }
   ```
   
   ### Are you willing to submit PR?
   
   - [ ] 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