Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Attachment Support for Mail Executor #812

Closed
yottahmd opened this issue Feb 7, 2025 · 3 comments · Fixed by #814
Closed

Add Attachment Support for Mail Executor #812

yottahmd opened this issue Feb 7, 2025 · 3 comments · Fixed by #814
Assignees
Labels
enhancement New feature to be implemented good first issue Good for newcomers

Comments

@yottahmd
Copy link
Collaborator

yottahmd commented Feb 7, 2025

Currently, the mail executor sends plain text emails without file attachments. We should extend its functionality to include an attachments field in the configuration, allowing users to specify one or more file paths to attach to outgoing emails.

How to Implement:

  1. Extend the Configuration Schema:
    Add an Attachments field (a slice of strings) to the mail executor’s configuration structure. For example:

    type MailExecutorConfig struct {
        To          string
        From        string
        Subject     string
        Message     string
        Attachments []string
    }
  2. Update the Mail Sending Logic:
    Modify the mail executor code that builds and sends the email to loop through the Attachments list and attach each file. Be sure to include file existence checks and error handling.

  3. Update Documentation and Examples:
    Add an example in the documentation to show how to use the new field in a DAG file.

Example Usage in a DAG File:

steps:
  - name: send report
    executor:
      type: mail
      config:
        to: [email protected]
        from: [email protected]
        subject: "Daily Report"
        message: "Attached is the daily report."
        attachments:
          - /tmp/report.csv
          - /tmp/summary.png
@yottahmd yottahmd added enhancement New feature to be implemented good first issue Good for newcomers labels Feb 7, 2025
@ghansham
Copy link

ghansham commented Feb 7, 2025

It can have fields for mail server configuration like smtp or tls with port configuration. What about passwords for user accounts? How to store them?

@yottahmd
Copy link
Collaborator Author

yottahmd commented Feb 8, 2025

Good idea! Currently Dagu's stmp setting is defined at the DAG level. It is possible to add a separate step-level field, allowing user to specify different settings for each steps. I'd be happy to add that if anyone submits a PR.
Regarding secret values, we currently support environment variables via dotenv file. Env vars are not logged or stored in persistent files. In the future, I plan to add support for secret management services such as AWS SecretManager, Hachicorp Vault, and others.

@ghansham
Copy link

ghansham commented Feb 8, 2025

Yeah I saw in the reference documentation for dag level settings. We could add support for TLS in dag level settings.

@arky arky self-assigned this Feb 8, 2025
arky added a commit to arky/dagu that referenced this issue Feb 9, 2025
arky added a commit to arky/dagu that referenced this issue Feb 10, 2025
arky added a commit to arky/dagu that referenced this issue Feb 10, 2025
@yottahmd yottahmd linked a pull request Feb 10, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature to be implemented good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants