# Fix SMTP Connection Refused and Error 111

Troubleshoot SMTP connection refusal, timeouts and authentication errors. Check MailSlurp host, port and TLS settings, then confirm real email receipt.

If your app reports `ECONNREFUSED` or connection-refused error 111, it hasn't opened the connection needed to send mail. Start with the destination host, port and network path. You can leave the email template alone for this one.

A timeout and an authentication rejection need different checks. Record the exact error and the stage where it occurs before changing settings. That keeps a network problem from turning into unnecessary credential resets or repeated send attempts.

MailSlurp supports sending through SMTP and the email API, as well as receiving messages in private inboxes. Use the connection details for your account or inbox, then check receipt after the sender accepts the message.

## Check the host and port from the same environment

Copy the SMTP host and port from your MailSlurp access details in the dashboard or API. The [SMTP and IMAP documentation](/docs/imap-smtp/) explains account-wide and inbox-scoped credentials. Use the SMTP endpoint for sending; an inbox's email address is the recipient, not the server hostname.

Test the connection from the machine or container running the application. A successful connection from your laptop does not establish that a CI runner or hosted service has the same outbound access.

On a system with `nc` installed, set `SMTP_HOST` and `SMTP_PORT` to the values from those access details, then run:

```bash
nc -vz "$SMTP_HOST" "$SMTP_PORT"
```

This checks the TCP connection only. It does not authenticate, send a message or prove delivery. Node.js describes [ECONNREFUSED](https://nodejs.org/api/errors.html#common-system-errors) as a connection actively refused by the destination. Check for a wrong port, an unavailable listener or network rules that reject the connection. For a timeout, also inspect outbound firewall and hosting-provider restrictions.

Check [MailSlurp service status](https://status.mailslurp.com/) when the same correct endpoint fails from more than one environment. Keep the hostname, port, error and affected environment available for support; keep credentials private.

## Match the TLS mode to the endpoint

Use the encryption mode specified by the returned SMTP settings. Implicit TLS and STARTTLS begin their connections differently, so the right port with the wrong client mode can still fail.

If the TCP connection succeeds but TLS fails, inspect the certificate and handshake error. Update the client's trust store or configuration as appropriate. Keep certificate verification enabled; suppressing it can hide a wrong endpoint or an untrusted connection.

The [SMTP setup guide](/guides/smtp-imap/) shows how to retrieve the connection fields and configure clients. Recheck the complete set of host, port and TLS options together rather than trying unrelated ports at random.



### Connection fixed? Check that the email arrived

Send from your app to a MailSlurp inbox after fixing the connection. Check the message that arrives, then follow its signup or reset link to test the user's next step.

[Test the full email journey](/product/email-integration-testing/)



## Treat authentication errors separately

A reply such as `530 5.7.1 Authentication required` means the server was reached but the requested SMTP action needs authentication. Check that the client enables authentication and uses the correct SMTP username and password. Those fields are separate from the API key used in HTTP requests.

Use credentials for the intended account or inbox scope. If credentials were rotated, update the application's secret configuration and restart processes that cached the old values. Do not print passwords or unredacted SMTP authentication exchanges into logs.

The [SMTP authentication guide](/blog/smtp-authentication/) explains that part of the conversation. Resolve the server's actual response before retrying the message.

## Confirm receipt after a successful send

A successful SMTP submission is separate from the recipient receiving the email. Send to an inbox your test controls, wait for the expected sender or subject and inspect the delivered message. If the send was accepted but no matching email arrives, check the recipient, sending result and any bounce or rejection details.

The [receive-email API example](/blog/receive-email-in-code/) provides a bounded wait. For signup or reset emails, continue through the delivered link or code and check the resulting account. The [Playwright email guide](/blog/playwright-email-testing/) shows that browser sequence.

When asking for help, provide the redacted error, endpoint, transport mode and whether failure occurred before TLS, during authentication or after submission. Share message identifiers through your normal private support channel when needed, with credentials and usable tokens removed.
