Dashboard

Troubleshooting

Sending email

Mail ports are blocked for apps on HCode. Send email through a provider's HTTPS API on port 443 instead.

Apps on HCode can't connect to mail servers over SMTP, IMAP or POP. To send password resets, receipts and other mail, call an email provider's HTTPS API on port 443, which is open.

Blocked ports

Outgoing connections to these ports are refused, whatever the destination:

Ports Used for
25, 465, 587, 2525 SMTP: sending mail, including authenticated submission
110, 995 POP3: reading a mailbox
143, 993 IMAP: reading a mailbox

This covers every mail server, including your own and the SMTP relays that email providers offer. There is no allow-list and no setting to open these ports for a project.

Why

Your app's outgoing traffic leaves from IP addresses it shares with other customers' apps. If one app sent spam over SMTP, mail providers would block those addresses and every app on them would lose email.

What it looks like in your logs

The connection is refused straight away rather than timing out. In most languages the error is "connection refused", for example ECONNREFUSED in Node.js:

text
Error: connect ECONNREFUSED 203.0.113.10:587

Your mail library's own error text may wrap this. No mail server is reached, so there is no SMTP error code to look up.

Send mail through an HTTPS API

HCode doesn't offer its own mail relay for apps. Transactional email providers such as Postmark, SendGrid and Mailgun offer an HTTPS API as well as SMTP. To switch:

  1. Create an API key in your email provider's dashboard.
  2. Add it to your project as an environment variable, for example EMAIL_API_KEY.
  3. Change your app to send through the provider's API or SDK instead of an SMTP library or SMTP settings.
  4. Deploy, and send a test message.

If your framework sends mail through a pluggable "mailer" or "transport", look for the provider's API transport rather than its SMTP one.

Receiving mail

Reading a mailbox over IMAP or POP is blocked too. To process incoming mail, use a provider that delivers it to your app over HTTPS, usually as a webhook to a URL on your custom domain or generated address.