New to Kestra?
Use blueprints to kickstart your first workflows.
Download a CSV and email it as an attachment via the Resend SMTP API in Kestra, keeping your API key safe in a Kestra Secret.
id: send-email-with-attachment
namespace: company.team
tasks:
- id: dataset1
type: io.kestra.plugin.core.http.Download
uri: https://huggingface.co/datasets/kestra/datasets/raw/main/csv/products.csv
- id: send_email
type: io.kestra.plugin.email.MailSend
from: onboarding@resend.dev
to: benoit@kestra.io
username: resend
password: "{{ secret('RESEND_API_KEY') }}"
host: smtp.resend.com
port: 465
subject: Here is your dataset
attachments:
- name: data.csv
uri: "{{ outputs.dataset1.uri }}"
contentType: text/csv
htmlTextContent: Please find your dataset attached as a CSV file
Automate transactional and report-delivery emails by fetching a file over HTTP and sending it as an email attachment through the Resend SMTP service. This blueprint downloads a CSV dataset, then delivers it to a recipient as a data.csv attachment, so you can replace manual exports and ad hoc "please send me the file" requests with a repeatable, auditable workflow. Credentials never touch the YAML: the Resend API key is read from a Kestra Secret at runtime.
dataset1 task (io.kestra.plugin.core.http.Download) downloads a CSV file from a public HTTP URL and stores it in Kestra internal storage, exposing it as {{ outputs.dataset1.uri }}.send_email task (io.kestra.plugin.email.MailSend) connects to the Resend SMTP server (host: smtp.resend.com, port: 465) using username: resend and the password pulled from {{ secret('RESEND_API_KEY') }}.attachments property as data.csv with contentType: text/csv, and the email is sent with an HTML body via htmlTextContent.SMTP and the Resend API can send a message, but they cannot schedule the job, build the attachment, or react to upstream events. Kestra adds event and schedule triggers, automatic retries on transient SMTP failures, full execution lineage so you can see exactly which file was sent and when, and a declarative YAML definition that lives in version control. The email step becomes the last link in a pipeline rather than a disconnected manual action.
onboarding@resend.dev sender.smtp.resend.com on port 465.RESEND_API_KEY: your Resend API key, used as the SMTP password.RESEND_API_KEY secret to your Kestra instance.from and to addresses in the send_email task.data.csv attached.dataset1 URL or replace it with a task that generates a report (for example a query export) and attach that output instead.attachments list.subject and htmlTextContent with execution context to personalize each send.