Persistent "write EPIPE" error on Mail operation - Directus on Dokploy (Hostinger VPS)

Hi everyone,

I’m facing a persistent write EPIPE error whenever I try to send an email through a Directus “Mail” operation. I’ve tried every possible SMTP configuration, but the error remains the same.

My Setup:

  • Platform: Directus (latest) running on Dokploy.

  • Infrastructure: Hostinger VPS.

  • Email Provider: Hostinger SMTP (smtp.hostinger.com).

The Error:

JSON

{
  "type": "Error",
  "message": "write EPIPE",
  "code": "EPIPE",
  "syscall": "write"
}

What I’ve tried so far:

  1. Ports & Security: Tested Port 465 (Secure: true) and Port 587 (Secure: false).

  2. Connectivity: Verified connectivity via Terminal inside the container using nc -zv smtp.hostinger.com 465 (Connection is Open).

  3. Environment Variables: Configured EMAIL_SMTP_POOL=false, EMAIL_SMTP_IGNORE_TLS=false, and EMAIL_SMTP_TLS_REJECT_UNAUTHORIZED=false.

  4. Network Tweaks: Added NODE_OPTIONS="--dns-result-order=ipv4first".

  5. External Relays: Tried Resend SMTP, but surprisingly got the same EPIPE error.

  6. Redeploy: Performed a full “Redeploy” in Dokploy after every change to ensure environment variables are injected.

Observations: Even after deleting all mail-related environment variables, the error persists as EPIPE instead of a “Missing Configuration” error, which makes me suspect that Directus might be caching old configs or ignoring environment variables in this specific Docker setup.

Has anyone encountered this on Dokploy or similar VPS environments?

Any help would be greatly appreciated!

Heya!

The fact that you’re seeing the same EPIPE error with both Hostinger SMTP and Resend tells me this is almost certainly a network/Docker networking issue rather than an SMTP config problem.

write EPIPE means the remote end is closing the connection before Directus finishes writing to it. A few things that are worth trying:

  • Check the outbound connectivity on the SMTP ports from inside the container. You mentioned you verified the connectivity to the host, but was that on ports 465/587 specifically?
  • Check is hostinger/dokploy block outbound SMTP ports. Some VPS providers block ports 25/465/587 by default. I ran into this on DigitalOcean once

It’s indeed expected that it would fail when you remove all env vars, as Directus currently defaults to sendmail for emailing which likely doesn’t exist in this hosting environment.

For port 465, make sure you’re using EMAIL_SMTP_SECURE=true. For 587, use EMAIL_SMTP_SECURE=false .

My best guess is this is an outbound port restriction on the VPS level ~