Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
tutoriaux:install-email-server:install-email-server-part-3 [2023/01/06 16:41] – supprimée - modification externe (Unknown date) 127.0.0.1 | tutoriaux:install-email-server:install-email-server-part-3 [2024/07/06 01:16] (Version actuelle) – frater | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ====== Part 3 - Create Virtual Mailboxes ====== | ||
+ | |||
+ | In previous articles, we discussed how to set up your own mail server on Debian from scratch. In [[tutoriaux: | ||
+ | |||
+ | With **virtual mailboxes**, | ||
+ | |||
+ | ==== PostfixAdmin Features ==== | ||
+ | |||
+ | * manage mailboxes, virtual domains, and aliases | ||
+ | * vacation/ | ||
+ | * alias domains (forwarding one domain to another with recipient validation) | ||
+ | * users can manage their own mailbox (change alias, password, and vacation message) | ||
+ | * quota support for single mailboxes and total quota of a domain | ||
+ | * fetchmail integration: | ||
+ | * command line client postfixadmin-cli for those who don’t want to click around in a web interface 😉 | ||
+ | |||
+ | <WRAP round info> | ||
+ | Once you finish part 3, you can no longer use local Unix accounts as email addresses. You must create email addresses from the PostfixAdmin web interface. | ||
+ | </ | ||
+ | |||
+ | ==== Requirements ==== | ||
+ | |||
+ | I assume that you have followed [[tutoriaux: | ||
+ | |||
+ | Once the above requirements are met, let’s install and configure PostfixAdmin. | ||
+ | |||
+ | ===== Install MariaDB Database Server ===== | ||
+ | |||
+ | PostfixAdmin is written in PHP and requires a database (MySQL/ | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | sudo apt install mariadb-server mariadb-client</ | ||
+ | |||
+ | After it’s installed, MariaDB server should be automatically started. Use **systemctl** to check its status. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Sample output: | ||
+ | |||
+ | {{ tutoriaux: | ||
+ | |||
+ | If it’s not running, start it with this command: | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | To enable MariaDB to automatically start at boot time, run | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Now run the post-installation security script. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | When it asks you to enter MariaDB root password, press Enter key as the root password isn’t set yet. Your root account is already secured, so you should answer n to not set password. | ||
+ | |||
+ | {{ tutoriaux: | ||
+ | |||
+ | Next, you can press '' | ||
+ | |||
+ | {{ tutoriaux: | ||
+ | |||
+ | ===== Download PostfixAdmin on Debian Server ===== | ||
+ | |||
+ | PostfixAdmin is included in the default Debian repository. However, I don’t recommend it for the following reasons: | ||
+ | |||
+ | * It can create problems when you upgrade the Ubuntu system to a new version, resulting in upgrade failure. | ||
+ | * If you use Nginx, the postfixadmin package might automatically install Apache on your system. | ||
+ | * If you use MySQL, this package might remove MySQL from your system. | ||
+ | * The default postfixadmin package has a login loop issue from time to time. | ||
+ | |||
+ | So I will show you how to install the latest version of PostfixAdmin. Go to [[https:// | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Once downloaded, extract the archive to the ''/ | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | sudo tar xvf postfixadmin-3.3.11.tar.gz -C /var/www/ | ||
+ | |||
+ | sudo mv / | ||
+ | </ | ||
+ | |||
+ | ===== Setting Up Permissions ===== | ||
+ | |||
+ | PostfixAdmin requires a '' | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | sudo apt install acl | ||
+ | sudo setfacl -R -m u: | ||
+ | </ | ||
+ | |||
+ | Starting with Dovecot 2.3.11, the web server user needs permission to read Let’s Encrypt TLS certificate in order to do password hashing. Run the following two commands to grant permissions. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | ===== Create a Database and User for PostfixAdmin ===== | ||
+ | |||
+ | Log into MySQL/ | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Once you are logged in, create a database for PostfixAdmin using the following command. I named it '' | ||
+ | |||
+ | <code sql> | ||
+ | |||
+ | Then enter the command below to create a database user for PostfixAdmin. This command also grants all privileges of postfixadmin database to the user. Replace '' | ||
+ | |||
+ | <code sql> | ||
+ | |||
+ | Flush the privileges table for the changes to take effect and then get out of MariaDB shell. | ||
+ | |||
+ | <code sql> | ||
+ | |||
+ | exit;</ | ||
+ | |||
+ | ===== Configure PostfixAdmin ===== | ||
+ | |||
+ | The default PostfixAdmin configuration file is '' | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Add the following lines in the file, so PostfixAdmin can connect to MySQL/ | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | $CONF[' | ||
+ | $CONF[' | ||
+ | $CONF[' | ||
+ | $CONF[' | ||
+ | $CONF[' | ||
+ | $CONF[' | ||
+ | $CONF[' | ||
+ | $CONF[' | ||
+ | $CONF[' | ||
+ | if(@file_exists('/ | ||
+ | $CONF[' | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Save and close the file. Note that we will use the [[https:// | ||
+ | You should need to install this package: | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | ===== Create Apache Virtual Host or Nginx Config File for PostfixAdmin ===== | ||
+ | |||
+ | ==== Apache ==== | ||
+ | |||
+ | If you use Apache web server, create a virtual host for PostfixAdmin. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Put the following text into the file. Replace '' | ||
+ | |||
+ | <code apache> | ||
+ | < | ||
+ | ServerName postfixadmin.example.com | ||
+ | DocumentRoot / | ||
+ | |||
+ | ErrorLog ${APACHE_LOG_DIR}/ | ||
+ | CustomLog ${APACHE_LOG_DIR}/ | ||
+ | |||
+ | < | ||
+ | Options FollowSymLinks | ||
+ | AllowOverride All | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | Options FollowSymLinks MultiViews | ||
+ | AllowOverride All | ||
+ | Order allow,deny | ||
+ | allow from all | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Save and close the file. Then enable this virtual host with: | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Reload Apache for the changes to take effect. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Now you should be able to see the PostfixAdmin web-based install wizard at http:// | ||
+ | |||
+ | ==== Nginx ==== | ||
+ | |||
+ | If you use Nginx web server, create a virtual host for PostfixAdmin. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Put the following text into the file. Replace postfixadmin.example.com with your real domain name and don’t forget to set DNS A record for it. | ||
+ | |||
+ | <code nginx> | ||
+ | server { | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | root / | ||
+ | index index.php index.html; | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | | ||
+ | try_files $uri =404; | ||
+ | fastcgi_pass unix:/ | ||
+ | fastcgi_index index.php; | ||
+ | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
+ | include / | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Note: Debian 11 ships PHP7.4 and Debian 10 ships with PHP7.3. If you use Debian 10, then change '' | ||
+ | |||
+ | Save and close the file. Then test Nginx configuration. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | If the test is successful, reload Nginx for the changes to take effect. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Now you should be able to see the PostfixAdmin web-based install wizard at '' | ||
+ | |||
+ | ===== Install Required and Recommended PHP Modules ===== | ||
+ | |||
+ | Run the following command to install PHP modules required or recommended by PostfixAdmin on Debian 11. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | If you use Debian 10, run the following command. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Then restart Apache. (If you use Nginx, you don’t need to restart Nginx.) | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | ===== Enabling HTTPS ===== | ||
+ | |||
+ | To encrypt the HTTP traffic, we can enable HTTPS by installing a free TLS certificate issued from Let’s Encrypt. Run the following command to install Let’s Encrypt client (certbot) on Debian server. | ||
+ | |||
+ | Normally this step should have been performed during the [[tutoriaux: | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | If you use Apache, install the Certbot Apache plugin. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | And run this command to obtain and install TLS certificate. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | If you use Nginx, then you also need to install the Certbot Nginx plugin. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Next, run the following command to obtain and install TLS certificate. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Where | ||
+ | |||
+ | ^ certonly | ||
+ | ^ --apache | ||
+ | ^ --nginx | ||
+ | ^ --agree-tos | ||
+ | ^ --no-eff-email | ||
+ | ^ --redirect | ||
+ | ^ --hsts | ||
+ | ^ --staple-ocsp | ||
+ | ^ --email | ||
+ | ^ -d | domain, aka your mail server hostname. | ||
+ | |||
+ | The certificate should now be obtained and automatically installed, which is indicated by the message below. | ||
+ | |||
+ | {{ tutoriaux: | ||
+ | ===== Enable Statistics in Dovecot ===== | ||
+ | |||
+ | PostfixAdmin needs to read Dovecot statistics. Edit the Dovecot configuration file. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Add the following lines to the end of this file. | ||
+ | |||
+ | <code ini> | ||
+ | service stats { | ||
+ | unix_listener stats-reader { | ||
+ | user = www-data | ||
+ | group = www-data | ||
+ | mode = 0660 | ||
+ | } | ||
+ | |||
+ | unix_listener stats-writer { | ||
+ | user = www-data | ||
+ | group = www-data | ||
+ | mode = 0660 | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Save and close the file. Then add the web server to the '' | ||
+ | |||
+ | <code bash> | ||
+ | Restart Dovecot. | ||
+ | |||
+ | <code bash> | ||
+ | Grant permissions to the '' | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | ===== Finish the Installation in Web Browser ===== | ||
+ | |||
+ | Go to '' | ||
+ | |||
+ | {{ tutoriaux: | ||
+ | |||
+ | After creating the password hash, PostfixAdmin will display a line like below. | ||
+ | |||
+ | {{ tutoriaux: | ||
+ | |||
+ | <code php> | ||
+ | $CONF[' | ||
+ | </ | ||
+ | |||
+ | You need to open the '' | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Add the line displayed on PostfixAdmin setup page to the end of the file like below. | ||
+ | |||
+ | {{ tutoriaux: | ||
+ | |||
+ | After saving the file, you need to refresh the PostfixAdmin setup page and enter the setup password again, then create the admin account. | ||
+ | |||
+ | {{ tutoriaux: | ||
+ | |||
+ | Once the superadmin account is created, you can log into PostfixAdmin at '' | ||
+ | |||
+ | {{ tutoriaux: | ||
+ | |||
+ | ===== Configure Postfix to Use MySQL/ | ||
+ | |||
+ | By default, Postfix delivers emails only to users with a local Unix account. To make it deliver emails to virtual users whose information is stored in the database, we need to configure Postfix to use virtual mailbox domains. | ||
+ | |||
+ | First, we need to add MySQL map support for Postfix by installing the '' | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Then edit the Postfix main configuration file. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Add the following lines at the end of this file. | ||
+ | |||
+ | <code ini> | ||
+ | virtual_mailbox_domains = proxy: | ||
+ | virtual_mailbox_maps = | ||
+ | | ||
+ | | ||
+ | virtual_alias_maps = | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | Where: | ||
+ | |||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | We want to use dovecot to deliver incoming emails to the virtual users’ message store, so also add the following line at the end of this file. | ||
+ | |||
+ | <code ini> | ||
+ | |||
+ | {{ tutoriaux: | ||
+ | |||
+ | Save and close the file. Next, we need to create the '' | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Create the // | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Add the following content. Replace '' | ||
+ | |||
+ | <code ini> | ||
+ | user = postfixadmin | ||
+ | password = postfixadmin_password | ||
+ | hosts = localhost | ||
+ | dbname = postfixadmin | ||
+ | query = SELECT domain FROM domain WHERE domain=' | ||
+ | #query = SELECT domain FROM domain WHERE domain=' | ||
+ | #optional query to use when relaying for backup MX | ||
+ | #query = SELECT domain FROM domain WHERE domain=' | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | Create the // | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Add the following content. | ||
+ | |||
+ | <code ini> | ||
+ | user = postfixadmin | ||
+ | password = postfixadmin_password | ||
+ | hosts = localhost | ||
+ | dbname = postfixadmin | ||
+ | query = SELECT maildir FROM mailbox WHERE username=' | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | Create the // | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Add the following content. | ||
+ | |||
+ | <code ini> | ||
+ | user = postfixadmin | ||
+ | password = postfixadmin_password | ||
+ | hosts = localhost | ||
+ | dbname = postfixadmin | ||
+ | query = SELECT maildir FROM mailbox, | ||
+ | </ | ||
+ | |||
+ | Create the // | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Add the following content. | ||
+ | |||
+ | <code ini> | ||
+ | user = postfixadmin | ||
+ | password = postfixadmin_password | ||
+ | hosts = localhost | ||
+ | dbname = postfixadmin | ||
+ | query = SELECT goto FROM alias WHERE address=' | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | Create the // | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Add the following content. | ||
+ | |||
+ | <code ini> | ||
+ | user = postfixadmin | ||
+ | password = postfixadmin_password | ||
+ | hosts = localhost | ||
+ | dbname = postfixadmin | ||
+ | query = SELECT goto FROM alias, | ||
+ | </ | ||
+ | |||
+ | Create the // | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Add the following content. | ||
+ | |||
+ | <code ini> | ||
+ | # handles catch-all settings of target-domain | ||
+ | user = postfixadmin | ||
+ | password = postfixadmin_password | ||
+ | hosts = localhost | ||
+ | dbname = postfixadmin | ||
+ | query = SELECT goto FROM alias, | ||
+ | </ | ||
+ | |||
+ | Since the database passwords are stored in plain text so they should be readable only by user postfix and root, which is done by executing the following two commands. | ||
+ | |||
+ | <code bash> | ||
+ | sudo chmod 0640 / | ||
+ | sudo setfacl -R -m u: | ||
+ | </ | ||
+ | |||
+ | Next, we need to change the value of the '' | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Sample output: | ||
+ | |||
+ | <code ini> | ||
+ | |||
+ | The '' | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Now let’s open the Postfix main configuration file again. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Add the following lines at the end of this file. | ||
+ | |||
+ | <code ini> | ||
+ | virtual_mailbox_base = /var/vmail | ||
+ | virtual_minimum_uid = 2000 | ||
+ | virtual_uid_maps = static:2000 | ||
+ | virtual_gid_maps = static:2000 | ||
+ | </ | ||
+ | |||
+ | The first line defines the base location of mail files. The remaining 3 lines define which user ID and group ID Postfix will use when delivering incoming emails to the mailbox. We use the user ID 2000 and group ID 2000. | ||
+ | |||
+ | Save and close the file. Restart Postfix for the changes to take effect. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Next, we need to create a user named '' | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Create the mail base location. | ||
+ | |||
+ | <code bash> | ||
+ | Make vmail as the owner. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | ===== Configure Dovecot to Use MySQL/ | ||
+ | |||
+ | We also need to configure the Dovecot IMAP server to query user information from the database. First, run the following command to add MySQL support for Dovecot. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Then edit the // | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | In part 2, we used the following '' | ||
+ | |||
+ | < | ||
+ | |||
+ | Since we are using virtual mailbox domain now, we need to enable mail_home for the virtual users by adding the following line in the file, because virtual users don’t have home directories by default. | ||
+ | |||
+ | < | ||
+ | |||
+ | {{ tutoriaux: | ||
+ | |||
+ | Save and close the file. Then edit the // | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | In part 2, we used the following value for '' | ||
+ | |||
+ | < | ||
+ | |||
+ | The '' | ||
+ | |||
+ | Now we are using virtual mailbox domains, which means the username of every email address includes the domain part, so we need to change the '' | ||
+ | |||
+ | < | ||
+ | |||
+ | Uncomment the following line at the end of this file, so Dovecot can query user information from MySQL/ | ||
+ | |||
+ | < | ||
+ | |||
+ | Now you probably don’t want local Unix users to send emails without registering email addresses in PostfixAdmin, | ||
+ | |||
+ | < | ||
+ | |||
+ | It can be helpful to add the following two lines in this file to debug login issues. The login errors would be logged into ''/ | ||
+ | |||
+ | < | ||
+ | auth_debug_passwords = yes</ | ||
+ | |||
+ | {{ tutoriaux: | ||
+ | |||
+ | Save and close the file. | ||
+ | |||
+ | Edit the // | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Here is the content that you should have in this file. By default, all lines in this file are commented out, so you can simply copy and paste them at the bottom. Replace postfixadmin_password with the postfixadmin password you set in Step 2. | ||
+ | |||
+ | < | ||
+ | driver = mysql | ||
+ | connect = host=localhost dbname=postfixadmin user=postfixadmin password=postfixadmin_password | ||
+ | default_pass_scheme = ARGON2I | ||
+ | password_query = SELECT username AS user, | ||
+ | user_query = SELECT maildir, 2000 AS uid, 2000 AS gid FROM mailbox WHERE username = ' | ||
+ | iterate_query = SELECT username AS user FROM mailbox | ||
+ | </ | ||
+ | |||
+ | Restart Dovecot. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | When a user tries to log in, Dovecot would use the Argon2 algorithm to generate a password hash from the password entered by the user, then compare it with the password hash stored in the database. If they match, then the user can log in successfully. | ||
+ | |||
+ | ===== Add Domain and Mailboxes in PostfixAdmin ===== | ||
+ | |||
+ | Log in to PostfixAdmin web interface as the admin. Click the '' | ||
+ | |||
+ | [[..: | ||
+ | |||
+ | Then click '' | ||
+ | |||
+ | [[..: | ||
+ | |||
+ | Next, you can open your desktop email client such as Mozilla Thunderbird and add a mail account. | ||
+ | |||
+ | * Liste à puceIn the incoming server section, select IMAP protocol, enter '' | ||
+ | * In the outgoing section, select SMTP protocol, enter '' | ||
+ | |||
+ | [[..: | ||
+ | |||
+ | <WRAP round tip> | ||
+ | You can also use port 993 with SSL/TLS encryption for IMAP, and use port 465 with SSL/TLS encryption for SMTP. You should **not** use port 25 as the SMTP port in mail clients to submit outgoing emails. | ||
+ | </ | ||
+ | |||
+ | You should now be able to connect to your own email server and also send and receive emails with your desktop email client! Note that you cannot use local Unix accounts to login now. You must log in with the virtual user created from PostfixAdmin web interface. | ||
+ | |||
+ | ===== Troubleshooting Tips ===== | ||
+ | |||
+ | As a rule of thumb, you should always check the mail log (''/ | ||
+ | |||
+ | ==== Can’t login from Mail Clients ==== | ||
+ | |||
+ | If you can’t log into your mail server from a desktop mail client, scan your mail server to find if the ports are open. Note that you should run the following command from another Linux computer or server. If you run it on your mail server, then the ports will always appear to be open. | ||
+ | |||
+ | <code bash> | ||
+ | And check if Dovecot is running. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | You can also check the mail log (''/ | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | If you see the following error in the mail log, it’s likely that you didn’t set a correct password in the '' | ||
+ | |||
+ | < | ||
+ | postfix/ | ||
+ | postfix/ | ||
+ | </ | ||
+ | If you see the following error in the mail log, it’s because you forgot to add '' | ||
+ | |||
+ | < | ||
+ | |||
+ | ==== Cloudflare DNS ==== | ||
+ | |||
+ | As I said in part 1, if you use Cloudflare DNS service, you should not enable the CDN (proxy) feature when creating DNS A record and AAAA record for the hostname of your mail server. Cloudflare doesn’t support SMTP or IMAP proxy. | ||
+ | |||
+ | ==== Relay Access Denied ==== | ||
+ | |||
+ | If you see the “relay access denied” error when trying to send emails from a mail client, it’s most likely that you use port 25 as the SMTP port in your mail client. As I said a while ago, you should use port 587 or 465 as the SMTP port in mail clients (Mozilla Thunberbird, | ||
+ | |||
+ | [[..: | ||
+ | |||
+ | ==== iOS Mail App ==== | ||
+ | |||
+ | If you use the iOS Mail app to log into your mail server and encounter the following error. | ||
+ | |||
+ | ios the mail server is not responding | ||
+ | |||
+ | You can try to fix it by enforcing SSL encryption, for both SMTP and IMAP. | ||
+ | |||
+ | ios mail enforce SSL encryption | ||
+ | |||
+ | Fun fact: It seems the iOS Mail app has difficulty in supporting STARTTLS on IMAP port 143, but it supports STARTTLS on the submission port 587. | ||
+ | |||
+ | ==== Temporary Lookup Failure ==== | ||
+ | |||
+ | If your mail server was working fine for some time, but suddenly you find the following error in the mail log, | ||
+ | |||
+ | < | ||
+ | Aug 25 20:25:24 mx postfix/ | ||
+ | Aug 25 20:25:24 mx postfix/ | ||
+ | Aug 25 20:25:24 mx postfix/ | ||
+ | Aug 25 20:25:24 mx postfix/ | ||
+ | </ | ||
+ | |||
+ | It’s likely that your MariaDB/ | ||
+ | |||
+ | <code bash> | ||
+ | or | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | A common cause for this situation is that your server is out-of-memory. Check if your server has enough memory. | ||
+ | |||
+ | <code bash> | ||
+ | or | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | ===== Automatically Clean the Junk Folder and Trash Folder ===== | ||
+ | |||
+ | To delete emails in Junk folder for all users, you can run | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | To delete emails in Trash folder, run | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | I think it’s better to clean emails that have been in the Junk or Trash folder for more than 2 weeks, instead of cleaning all emails. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Then add a cron job to automate the job. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Add the following line to clean Junk and Trash folder every day. | ||
+ | |||
+ | < | ||
+ | |||
+ | You also need to allow the www-data user to read certificate files by adding the following line. | ||
+ | |||
+ | < | ||
+ | |||
+ | To receive report when a Cron job produces an error, you can add the following line above all Cron jobs. | ||
+ | |||
+ | < | ||
+ | |||
+ | Save and close the file. And you’re done. | ||
+ | |||
+ | ===== Change User Password in PostfixAdmin ===== | ||
+ | |||
+ | Users can log into PostfixAdmin at '' | ||
+ | |||
+ | ===== Restricting Access to Sendmail ===== | ||
+ | |||
+ | By default, any local user can use the '' | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Add the following line to the end of this file, so only the root, www-data and vmail user can submit emails via sendmail. You can also add other usernames. | ||
+ | |||
+ | < | ||
+ | |||
+ | Save and close the file. Then restart Postfix. | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | ====== How to Upgrade PostfixAdmin ====== | ||
+ | |||
+ | Sometimes there might be bugs in the current PostfixAdmin that can be fixed by upgrading to a new version. It’s very simple to upgrade PostfixAdmin. When a new version of PostfixAdmin comes out, then you need to | ||
+ | |||
+ | * Make a copy of the ''/ | ||
+ | * Remove the PostfixAdmin web directory ('' | ||
+ | * Go through step 2, step 3, step 5, and step 10 again in this tutorial. When doing step 5, simply copy the '' | ||
+ | |||
+ | I once had a login loop problem in my PostfixAdmin installation and it’s fixed by upgrading PostfixAdmin to the latest version. | ||
+ | |||
+ | ===== Next Step ===== | ||
+ | |||
+ | I hope this tutorial helped you install and use PostfixAdmin on Debian to create virtual mailboxes. In part 4, I will show you how to set up SPF and DKIM with Postfix to improve email deliverability and in a future tutorial, I’m going to show you how to host multiple domains with PostfixAdmin. | ||
+ | |||
+ | If you want to access emails from a web browser, then I recommend Roundcube, which is a very popular and featured-rich open-source webmail client. As always, if you found this post useful, subscribe to our free newsletter to get more tips and tricks. Take care 🙂 | ||
+ | |||
+ | {{page> | ||