Debian 12: Konfigurasi Postfix

Revision as of 21:03, 5 February 2025 by Kangtain (talk | contribs) (Created page with "==Configure Mail Server Hostname=== I assume you have a sudo user on your Debian server. Run the following commands on the server as root to install sudo. apt install sudo Log into your server via SSH and enter the following command to see the FQDN form of your server hostname. hostname -f If your Debian server doesn’t have an FQDN yet, you can use hostnamectl to set one. sudo hostnamectl set-hostname your-fqdn ==Install Postfix SMTP Server on Debian Server==...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Configure Mail Server Hostname=

I assume you have a sudo user on your Debian server. Run the following commands on the server as root to install sudo.

apt install sudo

Log into your server via SSH and enter the following command to see the FQDN form of your server hostname.

hostname -f

If your Debian server doesn’t have an FQDN yet, you can use hostnamectl to set one.

sudo hostnamectl set-hostname your-fqdn

Install Postfix SMTP Server on Debian Server

On your Debian server, run the following two commands.

sudo apt-get update
sudo apt-get install postfix -y

You will be asked to select a type for mail configuration. Normally, you will want to select the second type: Internet Site.

  • No configuration means the installation process will not configure any parameters in the /etc/postfix/main.cf file.
  • Internet Site means using Postfix for sending emails to other MTAs and receiving emails from other MTAs.
  • Internet with smarthost means using postfix to receive email from other MTAs, but using another smart host to relay emails to the recipient.
  • Satellite system means using a smart host for sending and receiving emails.
  • Local only means emails are transmitted between local user accounts only.

How To Increase Attachment Size Limit

By default, the attachment cannot be larger than 10MB, which is indicated by the message_size_limit parameter.

sudo postconf | grep message_size_limit

Output:

message_size_limit = 10240000

This parameter defines the size limit for emails originating from your own mail server and for emails coming to your mail server.

To allow attachment of 50MB in size, run the following command.

sudo postconf -e message_size_limit=52428800

When postconf command is invoked with the -e (edit) option, it will try to find the parameter (message_size_limit) in the Postfix main configuration file (/etc/postfix/main.cf) and change the value. If the parameter can’t be found, then it adds the parameter at the end of the file.

Note that the message_size_limit should not be larger than the mailbox_size_limit, otherwise Postfix might not be able to receive emails. The default value of mailbox_size_limit is 51200000 bytes (about 48MB) in the upstream Postfix package. On Debian, the default value is set to 0, as can be seen with

sudo postconf | grep mailbox_size_limit

Output:

mailbox_size_limit = 0

This means that the mailbox has no size limit, which is great.

Restart Postfix for the changes to take effect.

sudo systemctl restart postfix

When sending an email with large attachments from your mail server, you should also beware of the receiving server’s attachment size limit. For example, You can not send an attachment larger than 25MB to a Gmail address.