Adilson Magnus
Commercial Support

Hey there, our support is exclusive via Telegram, click on the bellow icon and start chat now.

Mon-Fri: 9:00–19:00 (GMT-03:00)

How to Test an SMTP Server Before Configuring it in MagnusBilling

When configuring email sending in MagnusBilling, the most common cause of “freezing” or failed messages is not MagnusBilling itself, but a connectivity issue between your server and the external SMTP provider. To save time, test the SMTP connection before registering the credentials inside MagnusBilling. This guide shows step-by-step tests you can run directly on your server.

 

1) Check if the SMTP Port is Open

Most providers use one of the following ports:

  • 465 (SSL/TLS)
  • 587 (STARTTLS)
  • 2525 (alternative port on some providers)

Run on your MagnusBilling server:

nc -vz -w5 smtp.your_domain.com 465
nc -vz -w5 smtp.your_domain.com 587
nc -vz -w5 smtp.your_domain.com 2525

If the output shows succeeded!, the port is open. If you see Connection timed out or Connection refused, the datacenter or firewall is blocking outbound SMTP on that port.


2) Test the TLS/SSL Handshake with OpenSSL

Port 465 (SSL/TLS direct)

openssl s_client -connect smtp.your_domain.com:465 -servername smtp.your_domain.com -crlf -quiet

Port 587 (STARTTLS)

openssl s_client -starttls smtp -connect smtp.your_domain.com:587 -servername smtp.your_domain.com -crlf -quiet

Expected result:

  • A banner starting with 220 ... ESMTP
  • A valid certificate: Verify return code: 0 (ok)

If the connection hangs or fails before the banner or certificate verification, your datacenter may be blocking the port or there is a TLS/route problem.


3) Perform a Full Authentication Test with Swaks

Swaks is a CLI tool that simulates a full SMTP transaction (DNS → TCP → TLS → AUTH). Install it and run:

apt install swaks -y

Replace credentials with yours:

swaks --server smtp.your_domain.com --port 465 \
  --to to_email@yourdomain \
  --from user@your_domain.com \
  --auth LOGIN \
  --auth-user user@your_domain.com \
  --auth-password 'yourpassword' \
  --header "Subject: Swaks Test Email" \
  --body "This is a test email sent using Swaks." \
  --tls

This quickly reveals whether the failure is due to connection, TLS negotiation, or authentication.


4) Common Problems and Solutions

  • Datacenter blocks outbound SMTP (465/587)
    Open a support ticket requesting unblocking of outbound SMTP ports. If not possible, check if your provider supports 2525 and use that port.
  • TLS handshake issues
    Ensure system date/time is correct and update CA bundles:
    apt update && apt install ca-certificates -y
    
  • Authentication fails
    Verify username/password. Some providers require the From address to match the authenticated account.

5) Configure in MagnusBilling

Only after confirming the SMTP server responds correctly should you configure it in MagnusBilling. This guarantees emails will be sent without hanging due to network restrictions or TLS errors.


Conclusion: Testing SMTP from your server with nc, openssl, and swaks before registering credentials in MagnusBilling is the fastest way to isolate connectivity and configuration problems, ensuring reliable email delivery from day one.