/go/smtp: smtp from the Command Line

/go/smtp manages SMTP port 25 on the server. It does two separate jobs: Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# Stop all outgoing port 25 connections (spam emergency)
/go/smtp block

# Allow them again
/go/smtp unblock

# Make Postfix also listen on port 26
/go/smtp enable

Arguments

Matching is case-sensitive.

You type What happens
block Sends the alerts, then blocks outgoing port 25.
unblock Removes the outgoing port 25 block.
enable or 26 Postfix also listens on port 26. The setting is saved as 26.
Nothing, or any other word Port 26 is turned off. The setting is saved as 25.

[!WARNING]
Only the exact words above are recognized. A typo such as blok or Block does not give an error. It falls through to the last row and turns port 26 off, then restarts Postfix.

Examples

# Block outgoing mail on port 25, then check the mail queue
/go/smtp block
postqueue -p | tail -1

# Allow outgoing mail again
/go/smtp unblock

# Add port 26 and open it in the firewall
/go/smtp enable
/go/allow 26

# Turn port 26 off again
/go/smtp disable

# Check whether the block rule is in place
sudo firewall-cmd --direct --get-all-rules # AlmaLinux, Rocky, CentOS, Red Hat, Fedora
sudo ufw status # Debian, Ubuntu

Output

Mode Output
block Port 25 is closed
unblock Port 25 is opened
enable, 26, or other Nothing

block and unblock end with exit status 1, even when they work. In scripts, read the output, not the exit status.

See the full reference at /go/smtp and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *