GoAdmio

checkmail

Test whether outbound mail port 25 works from this server, and whether the SMTP (465) and IMAP (993) SSL certificates are installed. This command also opens the local firewall.

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

Many hosting providers block outbound connections on port 25, which stops a server from delivering email to other mail servers. /go/checkmail tells you whether your provider does this. It:

[!WARNING] Despite its name, this command changes the firewall. It opens all ports in iptables and removes the firewalld rules that block outbound port 25. See Firewall changes.


Quick start

/go/checkmail

Syntax

/go/checkmail

The command takes no options or arguments. Run it as root. It needs nc (netcat), openssl, and whois.


Options

None. Any arguments you pass are ignored.


Output

Message Meaning
Your ISP <name> blocking SMTP Port 25 The connection to port 25 failed or timed out. The name is taken from the whois record of the server's IP address, and can be empty.
Port 25 is opened The connection to port 25 worked.
Port 465 is opened The SMTP certificate contains the server host name.
SMTP SSL is not installed (<hostname>) The SMTP certificate does not contain the host name. Recommended steps follow.
Port 993 is opened The IMAP certificate contains the IMAP host name.
IMAP SSL is not installed (<hostname>) The IMAP certificate does not contain the IMAP host name.

When the SMTP certificate is missing, the command also prints:

Recommended:
1 - Point a Hostname <hostname> to your Server IP <server-ip>
2 - Run "/go/installmail"

The command prints nothing when the port 25 test gives a result that matches none of the cases above, for example when nc is not installed. Port 465 and port 993 are only reported when port 25 works. No email or WhatsApp alert is sent. Each run adds a line to /var/log/go/checkmail.log.


Examples

# Run the check
/go/checkmail
# Test port 25 yourself
nc -zv -w 3 gmail-smtp-in.l.google.com 25
# See the first rules of the local firewall
iptables -S | head

Troubleshooting

Symptom Likely cause Fix
Your ISP <name> blocking SMTP Port 25 Your provider blocks outbound port 25. Ask the provider to unblock it, or send mail through a relay. See smtp and brevo.
The message names your provider, but you know port 25 is open A local firewall rule was blocking port 25 during the test. The command removes that rule only after the test (see Known issues). Run the command a second time.
Nothing is printed The test output matched no case, for example nc is not installed. Install netcat, then run again.
SMTP SSL is not installed (<hostname>) The SMTP certificate is missing, or the host name does not point to this server. Point the host name to the server IP, then run installmail.
IMAP SSL is not installed (<hostname>) The IMAP certificate is missing or for another name. See checkimap and mailssl.
The firewall is open to everything after the command See Firewall changes. Reinstall the firewall rules with firewall.
Permission denied or the firewall is unchanged The command was run without root. Run it as root.

Details

What it does, in order

  1. Logs the run to /var/log/go/checkmail.log.
  2. Reads the server host name, the IMAP host name from /etc/imap (or the server host name if the file does not exist), and the server's public IP.
  3. Tests a connection to gmail-smtp-in.l.google.com on port 25, with a 3 second limit.
  4. Connects with openssl to localhost:465 and localhost:993 and saves the answers.
  5. Changes the firewall (see below).
  6. Reads the test results and prints the messages.

Firewall changes

System Change
iptables installed Inserts ACCEPT rules at the top of the INPUT and OUTPUT chains. All traffic is then accepted before any other rule is looked at.
firewalld installed Permanently removes the direct rules that drop outbound TCP port 25 for IPv4 and IPv6, then reloads firewalld.

The iptables rules are not removed afterwards. They are not saved, so a firewall reload or a restart normally removes them, but until then every port is open. Reinstall the firewall with firewall, and check the required ports with checkfirewall.

Known issues


See also

Command Description
checkimap Check the IMAP port and SSL certificate
checksmtp Check the SMTP port and SSL certificate
smtp Manage the SMTP port: block, unblock, and change it
brevo Manage Brevo (Sendinblue) transactional email integration
installmail Install and configure webmail services (Postfix and Dovecot)
firewall Install a firewall on a GoAdmio server
checkfirewall Verify that important required ports are open on your server