Menu
User

DropVPS Team

Writer: John hens

how to setup smtp server in Debian 13

how to setup smtp server in Debian 13

Publication Date

11/11/2025

Category

Articles

Reading Time

2 Min

Table of Contents

Setting up an SMTP server on Debian 13 allows you to send emails directly from your server for applications, notifications, or personal use. Using Postfix, a reliable and widely used mail transfer agent, you can quickly create a secure and functional SMTP server. 

Step 1: Update Your System

Before installing any software, it’s important to update your Debian 13 system to ensure all packages are current and compatible.

sudo apt update && sudo apt upgrade -y

Step 2: Install Postfix

Postfix is a stable and efficient SMTP server that handles outgoing and incoming emails. Installing it provides a solid foundation for your email setup on Debian 13.

sudo apt install postfix -y

Step 3: Configure Postfix

After installation, configure Postfix to handle mail correctly by editing the main configuration file. This ensures your server uses the correct domain and can send emails reliably.

sudo nano /etc/postfix/main.cf

Add or update these lines (replace yourdomain.com with your domain):

myhostname = mail.yourdomain.com
mydomain = yourdomain.com
myorigin = /etc/mailname
inet_interfaces = all
inet_protocols = ipv4
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

Step 4: Restart Postfix

After configuring Postfix, restart the service so all changes take effect and your SMTP server is active and ready to send emails.

sudo systemctl restart postfix
sudo systemctl enable postfix

Step 5: Configure Firewall

Allow traffic on the SMTP port to ensure your server can send and receive emails. Opening port 25 in the firewall is essential for proper email delivery.

sudo ufw allow 25/tcp
sudo ufw reload

Step 6: Test SMTP Server

Verify that your SMTP server is working correctly by connecting locally with telnet. This confirms that Postfix is running and ready to handle emails.

telnet localhost 25

Step 7: Enable SMTP Authentication

For secure email sending and to prevent unauthorized use, enable SMTP authentication with SASL. This ensures that only authorized users can send emails through your server.

sudo apt install libsasl2-modules
sudo postconf -e 'smtpd_sasl_auth_enable = yes'
sudo systemctl restart postfix
Linux VPS
U
Loading...

Related Posts