Ubuntu 25.04
Sponsored Link

Mail Server : Install Postfix2025/04/23

 

Install Postfix to configure SMTP Server. SMTP uses [25/TCP].

[1] This example shows to configure SMTP-Auth to use Dovecot's SASL function.
root@mail:~#
apt -y install postfix sasl2-bin
# on this example, proceed to select [No Configuration]
# because configure all manually

+------+ Postfix Configuration +-------+
| General type of mail configuration:  |
|                                      |
|       No configuration               |
|       Internet Site                  |
|       Internet with smarthost        |
|       Satellite system               |
|       Local only                     |
|                                      |
|                                      |
|       <Ok>           <Cancel>        |
|                                      |
+--------------------------------------+

root@mail:~#
cp /usr/share/postfix/main.cf.dist /etc/postfix/main.cf

root@mail:~#
vi /etc/postfix/main.cf
# line 82 : uncomment
mail_owner = postfix

# line 97 : if listen only IPv4, change to [ipv4]
inet_protocols = all

# line 106 : uncomment and specify hostname
myhostname = mail.srv.world

# line 114 : uncomment and specify domainname
mydomain = srv.world

# line 133 : comment out
# line 135 : uncomment
#myorigin = /etc/mailname
#myorigin = $myhostname
myorigin = $mydomain

# line 149 : uncomment
inet_interfaces = all

# line 197 : uncomment
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

# line 285 : uncomment
mynetworks_style = subnet

# line 299 : uncomment and add your local network
mynetworks = 127.0.0.0/8, 10.0.0.0/24

# line 423 : uncomment
alias_maps = hash:/etc/aliases

# line 434 : uncomment
alias_database = hash:/etc/aliases

# line 456 : uncomment
home_mailbox = Maildir/

# line 592: comment out and add
#smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_banner = $myhostname ESMTP

# line 665 : uncomment
sendmail_path = /usr/sbin/sendmail

# line 670 : uncomment
newaliases_path = /usr/bin/newaliases

# line 675 : uncomment
mailq_path = /usr/bin/mailq

# line 681 : uncomment
setgid_group = postdrop

# add follows to last line
# disable SMTP VRFY command
disable_vrfy_command = yes

# require HELO command to sender hosts
smtpd_helo_required = yes

# limit an email size
# example below means 10M bytes limit
message_size_limit = 10240000

# SMTP-Auth settings
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = 
  permit_mynetworks,
  permit_sasl_authenticated,
  reject_unauth_destination

root@mail:~#
touch /etc/aliases

root@mail:~#
root@mail:~#
systemctl restart postfix

Matched Content