Mailhook, FTP and MySQL: Partner Data Feed Template
When a partner emails a data file to a dedicated mailhook address, this template archives the file to FTP and loads its rows into a MySQL staging table.
What It Builds
A Mailhook trigger receives any email sent to a unique Spojit address. An Attachment node pulls the file bytes off the email, a Connector node on the ftp connector uploads the original file to an archive folder, and a second Connector node on the mysql connector inserts the parsed rows into a staging table. The result is a hands-off partner data feed: partners just email their file, and Spojit keeps a copy and stages the data for you.
The Prompt
Paste this into Miraxa, the intelligent layer across your automation, and it builds the workflow and connects the tools for you:
Build a workflow that triggers on a Mailhook. When a partner emails a CSV data file to the mailhook address, use an Attachment node to fetch the first .csv attachment, upload the original file to my FTP server under /archive/partner-feeds/ using the ftp connector, then parse the CSV into rows and insert those rows into the partner_staging table in MySQL using the mysql connector. If no attachment is found, send me an email letting me know.
Connectors Used
- Mailhook trigger - generates a unique
<prefix>-<random>@mailhook.spojit.comaddress; any email to it starts a run within seconds. Give partners this address. - Attachment node - fetches the actual bytes of the emailed file referenced by the Mailhook trigger (Mailhook workflows only).
- ftp - archives the original file with
upload-fileso you keep an untouched copy of every feed. - mysql - loads the parsed rows into your staging table with
insert-rows.
Customize It
Change the file type and pattern in the prompt (for example a *.tsv or *.xlsx filename pattern instead of CSV), the FTP archive path, and the destination database and table name. To accept files from only trusted senders, add a From allowlist on the Mailhook trigger so unrelated mail is ignored. If you want each load isolated, point the FTP path at a dated subfolder by templating it with a value like {{ input.receivedAt }}.
Tips
- Keep the mysql
insert-rowsstep in Direct mode: row inserts are deterministic and Direct mode runs without AI credits. - Set the Attachment node Filename pattern (for example
*.csv) so the node grabs the right file even when partners attach a signature image or logo as well. - Mailhook attachments cap at 10 MB each and 25 MB per run by default; for very large feeds, have partners drop the file on FTP directly and trigger on a schedule instead.
Common Pitfalls
- If your staging table column order does not match the CSV columns, the insert maps the wrong values. Confirm the table layout, or have Miraxa add a Transform step that maps fields by name before
insert-rows. - The Mailhook trigger is always async and never replies to the sender. If a partner expects a confirmation, add a Send Email node back to
{{ input.replyTo }}. - Received emails are retained for 30 days, so the FTP archive is your durable copy. Do not rely on the mailbox for long-term storage.
Related
- How to Build an ETL Pipeline with CSV, Transform, and MySQL if you want the step-by-step build behind the MySQL load.
- How to Export Orders to CSV via FTP for the reverse direction of moving files over FTP.
- How to Create Shopify Orders from PO PDFs Emailed to a Mailhook for another Mailhook plus Attachment pattern.