{"id":15408,"date":"2024-10-18T06:37:39","date_gmt":"2024-10-18T06:37:39","guid":{"rendered":"https:\/\/truehost.com\/support\/?post_type=docs&#038;p=15408"},"modified":"2024-11-20T11:44:20","modified_gmt":"2024-11-20T11:44:20","password":"","slug":"how-to-configure-a-mail-server-with-dovecot-and-postfix","status":"publish","type":"docs","link":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-a-mail-server-with-dovecot-and-postfix\/","title":{"rendered":"How to Configure a Mail Server with Dovecot and Postfix on Almalinux"},"content":{"rendered":"\n<p>Postfix is a widely-used mail server for sending and receiving emails. It is highly configurable and can be combined with Dovecot to enable POP\/IMAP functionality, creating a fully-featured mail server. <\/p>\n\n\n\n<p>In this guide, we will walk you through the setup of a mail server running Postfix and Dovecot on a Linux server, with a focus on Almalinux. I will use Almalinux 8.4 here.<\/p>\n\n\n\n<p>By the end of this tutorial, you&#8217;ll have a working mail server capable of handling email traffic.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Overview:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Postfix<\/strong>: Acts as the <strong>Mail Transfer Agent (MTA)<\/strong>, responsible for receiving and sending emails using <strong>SMTP (Simple Mail Transfer Protocol)<\/strong>.<\/li>\n\n\n\n<li><strong>Dovecot<\/strong>: Acts as both the <strong>Mail Delivery Agent (MDA)<\/strong> and <strong>IMAP\/POP3 server<\/strong>, managing how email is stored and how users can access it.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A server with Almalinux Installed<\/li>\n\n\n\n<li><strong>Root or Sudo Access<\/strong> to the server:<\/li>\n\n\n\n<li>A hostname set up for the server and shoud point to the server IP (e.g., <code>mail.example.com<\/code>).<\/li>\n\n\n\n<li><strong>A Fully Qualified Domain Name (FQDN)<\/strong> <\/li>\n\n\n\n<li><strong>DNS Records<\/strong>:\n<ul class=\"wp-block-list\">\n<li><strong>MX Record<\/strong>: Point the domain&#8217;s MX to your mail server (e.g., <code>mail.example.com<\/code>).<\/li>\n\n\n\n<li><strong>SPF, DKIM, and DMARC Records<\/strong> (recommended for improved email delivery and security):<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Install Required Packages<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong> Update your server<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>s<span style=\"background-color: initial; color: inherit; font-family: inherit; font-size: inherit;\">udo dnf update -y<\/span><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li> Install Postfix and Dovecot: <\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install postfix dovecot -y<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Enable and start Postfix and Dovecot services:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo systemctl enable --now postfix <\/code>\n<code>sudo systemctl enable --now dovecot<\/code><\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Configure Postfix<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Edit the Postfix configuration file (<code>\/etc\/postfix\/main.cf<\/code>)<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo vi \/etc\/postfix\/main.cf<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Set basic configurations by adding or modifying these lines. They possibly exist and commented out, so just trace them and remove the comment (#), then edit accordingly.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>myhostname = mail.example.com         # Set your hostname\nmydomain = example.com                # Set your domain\nmyorigin = $mydomain\ninet_interfaces = all\ninet_protocols = ipv4\nmydestination = $myhostname, localhost.$mydomain, localhost\nrelayhost =<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Still in the same file, set mailbox and security configurations adding or modifying these lines. They possibly exist and commented out, so just trace them and remove the comment (#), then edit accordingly. Replace <strong>mail.example.com<\/strong> with you server&#8217;s hostname.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>home_mailbox = Maildir\/ # Use Maildir format\nsmtpd_tls_cert_file = \/etc\/letsencrypt\/live\/<strong>mail.example.com<\/strong>\/fullchain.pem\nsmtpd_tls_key_file = \/etc\/letsencrypt\/live\/<strong>mail.example.com<\/strong>\/privkey.pem\nsmtpd_use_tls = yes\nsmtpd_tls_session_cache_database = btree:${data_directory}\/smtpd_scache\nsmtp_tls_session_cache_database = btree:${data_directory}\/smtp_scache\nsmtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"668\" height=\"69\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-553.png\" alt=\"\" class=\"wp-image-15851\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-553.png 668w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-553-300x31.png 300w\" sizes=\"auto, (max-width: 668px) 100vw, 668px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"821\" height=\"130\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-552.png\" alt=\"\" class=\"wp-image-15849\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-552.png 821w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-552-300x48.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-552-768x122.png 768w\" sizes=\"auto, (max-width: 821px) 100vw, 821px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Configure Postfix to use Dovecot for SASL authentication: <\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>smtpd_sasl_type = dovecot\nsmtpd_sasl_path = private\/auth\nsmtpd_sasl_auth_enable = yes\nsmtpd_tls_security_level = may\nsmtpd_sasl_security_options = noanonymous<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"511\" height=\"123\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-551.png\" alt=\"\" class=\"wp-image-15848\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-551.png 511w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-551-300x72.png 300w\" sizes=\"auto, (max-width: 511px) 100vw, 511px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Save and exit  (<code>:wq + X<\/code> to save in vim, then <code>Y<\/code> to confirm and <code>Enter<\/code>).<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Restart Postfix:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo systemctl restart postfix<\/code><\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"596\" height=\"131\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-554.png\" alt=\"\" class=\"wp-image-15852\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-554.png 596w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-554-300x66.png 300w\" sizes=\"auto, (max-width: 596px) 100vw, 596px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Configure Dovecot<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Edit the Dovecot configuration file (<code>\/etc\/dovecot\/dovecot.conf<\/code>): Just as it was in postfix config file, these lines in dovecot config file possibly exist and commented out, so just trace them and remove the comment (#), then edit accordingly.<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vi \/etc\/dovecot\/dovecot.conf<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Set protocols and mail location:<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>protocols = imap pop3 lmtp\nmail_location = maildir:~\/Maildir<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"822\" height=\"58\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-555.png\" alt=\"\" class=\"wp-image-15853\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-555.png 822w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-555-300x21.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-555-768x54.png 768w\" sizes=\"auto, (max-width: 822px) 100vw, 822px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Configure authentication mechanisms in <code>\/etc\/dovecot\/conf.d\/10-auth.conf<\/code>:<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vi \/etc\/dovecot\/conf.d\/10-auth.conf<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ensure the following settings<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>disable_plaintext_auth = yes<br>auth_mechanisms = plain login<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"722\" height=\"74\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-556.png\" alt=\"\" class=\"wp-image-15855\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-556.png 722w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-556-300x31.png 300w\" sizes=\"auto, (max-width: 722px) 100vw, 722px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"544\" height=\"115\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-557.png\" alt=\"\" class=\"wp-image-15857\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-557.png 544w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-557-300x63.png 300w\" sizes=\"auto, (max-width: 544px) 100vw, 544px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Configure Dovecot to handle Postfix SASL requests by editing <code>\/etc\/dovecot\/conf.d\/10-master.conf<\/code><\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vi \/etc\/dovecot\/conf.d\/10-master.conf<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Look for the <code>service auth<\/code> section, and add these lines:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>unix_listener \/var\/spool\/postfix\/private\/auth {<br>mode = 0666<br>user = postfix<br>group = postfix<br>}<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"314\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-558-1024x314.png\" alt=\"\" class=\"wp-image-15859\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-558-1024x314.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-558-300x92.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-558-768x236.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-558.png 1081w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Generate an SSL Certificate using Let\u2019s Encrypt  \n<ul class=\"wp-block-list\">\n<li>Let\u2019s Encrypt provides free SSL certificates trusted by most clients. You\u2019ll need to install Certbot, the Let\u2019s Encrypt client, and request a certificate. Replace <strong>mail.example.com<\/strong> with you server&#8217;s hostname.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install epel-release -y\nsudo dnf install certbot -y\nsudo certbot certonly --standalone -d <strong>mail.example.com<\/strong><\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"991\" height=\"333\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-563.png\" alt=\"\" class=\"wp-image-15873\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-563.png 991w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-563-300x101.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-563-768x258.png 768w\" sizes=\"auto, (max-width: 991px) 100vw, 991px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Once Certbot has issued the certificate, update your Dovecot and Postfix configurations to use the following paths.  Set up SSL\/TLS for Dovecot in <code>\/etc\/dovecot\/conf.d\/10-ssl.conf<\/code><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vi \/etc\/dovecot\/conf.d\/10-ssl.conf<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Add or modify the following lines, again replacing <strong>mail.example.com<\/strong> with you server&#8217;s hostname<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>ssl = yes \nssl_cert = &lt;\/etc\/letsencrypt\/live\/mail.example.com\/fullchain.pem\nssl_key = &lt;\/etc\/letsencrypt\/live\/mail.example.com\/privkey.pem<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"721\" height=\"211\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-562.png\" alt=\"\" class=\"wp-image-15868\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-562.png 721w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-562-300x88.png 300w\" sizes=\"auto, (max-width: 721px) 100vw, 721px\" \/><\/figure>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Open the Mail Ports in Firewall<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Allow SMTP, IMAP, and POP3 ports through the firewall<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo firewall-cmd --permanent --add-service=http\nsudo firewall-cmd --permanent --add-service=smtp\nsudo firewall-cmd --permanent --add-service=imap\nsudo firewall-cmd --permanent --add-service=pop3\nsudo firewall-cmd --reloadsudo firewall-cmd --permanent --add-service=smtp\nsudo firewall-cmd --permanent --add-service=imap\nsudo firewall-cmd --permanent --add-service=pop3\nsudo firewall-cmd --reload<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"343\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-560-1024x343.png\" alt=\"\" class=\"wp-image-15863\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-560-1024x343.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-560-300x101.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-560-768x257.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-560.png 1146w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Restart dovecot service<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo systemctl restart dovecot<\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5: Test Your Mail Server<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check Postfix status:<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl status postfix<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"284\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-561-1024x284.png\" alt=\"\" class=\"wp-image-15865\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-561-1024x284.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-561-300x83.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-561-768x213.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-561.png 1026w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>If postfix is not running, start it using this command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl start postfix<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check Dovecot status<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl status dovecot<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"357\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-564-1024x357.png\" alt=\"\" class=\"wp-image-15876\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-564-1024x357.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-564-300x105.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-564-768x268.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-564.png 1103w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Step  6a: Send a Test Email Using <code>mail<\/code> Command<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <code>mail<\/code> command is a simple way to test email sending. First, install the <code>mailx<\/code> package if it\u2019s not already installed:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install mailx -y<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"486\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-565-1024x486.png\" alt=\"\" class=\"wp-image-15881\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-565-1024x486.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-565-300x143.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-565-768x365.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-565.png 1162w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Then, send a test email to an external email address (like Gmail) to check if outgoing mail works:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"This is a test email from my server\" | mail -s \"Test Email\" your-email@example.com<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"141\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-566-1024x141.png\" alt=\"\" class=\"wp-image-15883\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-566-1024x141.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-566-300x41.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-566-768x106.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-566.png 1117w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Check Postfix Logs<\/strong>: To verify if the email was successfully sent, review Postfix logs:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo tail -f \/var\/log\/maillog<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"968\" height=\"310\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-567.png\" alt=\"\" class=\"wp-image-15887\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-567.png 968w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-567-300x96.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-567-768x246.png 768w\" sizes=\"auto, (max-width: 968px) 100vw, 968px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step  6a: Test Receiving Mail with a Mail Client (e.g., Thunderbird or Outlook)<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Configure an email client to connect to your server using IMAP or POP3. Use the FQDN you set up for your mail server (again replacing <strong>mail.example.com<\/strong> with you server&#8217;s hostname) and the email account credentials you configured.<\/li>\n\n\n\n<li><strong>Settings<\/strong> for IMAP:\n<ul class=\"wp-block-list\">\n<li><strong>IMAP Server<\/strong>: <code>mail.example.com<\/code><\/li>\n\n\n\n<li><strong>Port<\/strong>: 993 (for IMAPS\/SSL) or 143 (for plain IMAP)<\/li>\n\n\n\n<li><strong>Encryption<\/strong>: SSL\/TLS<\/li>\n\n\n\n<li><strong>Username<\/strong>: Full email address (e.g., <code>user@example.com<\/code>)<\/li>\n\n\n\n<li><strong>Password<\/strong>: User\u2019s email password<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Settings<\/strong> for SMTP:\n<ul class=\"wp-block-list\">\n<li><strong>SMTP Server<\/strong>: <code>mail.example.com<\/code><\/li>\n\n\n\n<li><strong>Port<\/strong>: 587 (for STARTTLS) or 465 (for SMTPS\/SSL)<\/li>\n\n\n\n<li><strong>Encryption<\/strong>: STARTTLS or SSL\/TLS<\/li>\n\n\n\n<li><strong>Username<\/strong>: Full email address<\/li>\n\n\n\n<li><strong>Password<\/strong>: User\u2019s email password<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>This basic configuration should have your mail server running on AlmaLinux using Postfix and Dovecot with secure mail handling. For production, ensure that security configurations are optimized, including SPF, DKIM, and DMARC settings for email authentication.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n","protected":false},"excerpt":{"rendered":"<p>Postfix is a widely-used mail server for sending and receiving emails. It is highly configurable and can be combined with Dovecot to enable POP\/IMAP functionality, creating a fully-featured mail server. In this guide, we will walk you through the setup of a mail server running Postfix and Dovecot on a Linux server, with a focus [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_eb_attr":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"doc_category":[1820,1824,1835,1879,2128],"doc_tag":[],"class_list":["post-15408","docs","type-docs","status-publish","hentry","doc_category-cloud-servers-in-kenya","doc_category-dedicated-servers","doc_category-security","doc_category-servers","doc_category-vps-servers"],"year_month":"2026-07","word_count":1067,"total_views":"0","reactions":{"happy":"24","normal":"0","sad":"0"},"author_info":{"name":"Eugene","author_nicename":"eugene","author_url":"https:\/\/truehost.com\/support\/author\/eugene\/"},"doc_category_info":[{"term_name":"Cloud servers in Kenya","term_url":"https:\/\/truehost.com\/support\/docs-category\/cloud-servers-in-kenya\/"},{"term_name":"dedicated servers","term_url":"https:\/\/truehost.com\/support\/docs-category\/dedicated-servers\/"},{"term_name":"Security","term_url":"https:\/\/truehost.com\/support\/docs-category\/security\/"},{"term_name":"Servers","term_url":"https:\/\/truehost.com\/support\/docs-category\/servers\/"},{"term_name":"VPS-Servers","term_url":"https:\/\/truehost.com\/support\/docs-category\/vps-servers\/"}],"doc_tag_info":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Configure a Mail Server with Dovecot and Postfix on Almalinux -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-a-mail-server-with-dovecot-and-postfix\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Configure a Mail Server with Dovecot and Postfix on Almalinux -\" \/>\n<meta property=\"og:description\" content=\"Postfix is a widely-used mail server for sending and receiving emails. It is highly configurable and can be combined with Dovecot to enable POP\/IMAP functionality, creating a fully-featured mail server. In this guide, we will walk you through the setup of a mail server running Postfix and Dovecot on a Linux server, with a focus [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-a-mail-server-with-dovecot-and-postfix\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-20T11:44:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-553.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-configure-a-mail-server-with-dovecot-and-postfix\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-configure-a-mail-server-with-dovecot-and-postfix\\\/\",\"name\":\"How to Configure a Mail Server with Dovecot and Postfix on Almalinux -\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-configure-a-mail-server-with-dovecot-and-postfix\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-configure-a-mail-server-with-dovecot-and-postfix\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/image-553.png\",\"datePublished\":\"2024-10-18T06:37:39+00:00\",\"dateModified\":\"2024-11-20T11:44:20+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-configure-a-mail-server-with-dovecot-and-postfix\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-configure-a-mail-server-with-dovecot-and-postfix\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-configure-a-mail-server-with-dovecot-and-postfix\\\/#primaryimage\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/image-553.png\",\"contentUrl\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/image-553.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-configure-a-mail-server-with-dovecot-and-postfix\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/truehost.com\\\/support\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Configure a Mail Server with Dovecot and Postfix on Almalinux\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#website\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/\",\"name\":\"\",\"description\":\"Help In a Click\",\"publisher\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/truehost.com\\\/support\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#organization\",\"name\":\"Truehost Kenya\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-image_2026-04-16_174808866.png\",\"contentUrl\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-image_2026-04-16_174808866.png\",\"width\":240,\"height\":48,\"caption\":\"Truehost Kenya\"},\"image\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Configure a Mail Server with Dovecot and Postfix on Almalinux -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-a-mail-server-with-dovecot-and-postfix\/","og_locale":"en_US","og_type":"article","og_title":"How to Configure a Mail Server with Dovecot and Postfix on Almalinux -","og_description":"Postfix is a widely-used mail server for sending and receiving emails. It is highly configurable and can be combined with Dovecot to enable POP\/IMAP functionality, creating a fully-featured mail server. In this guide, we will walk you through the setup of a mail server running Postfix and Dovecot on a Linux server, with a focus [&hellip;]","og_url":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-a-mail-server-with-dovecot-and-postfix\/","article_modified_time":"2024-11-20T11:44:20+00:00","og_image":[{"url":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-553.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-a-mail-server-with-dovecot-and-postfix\/","url":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-a-mail-server-with-dovecot-and-postfix\/","name":"How to Configure a Mail Server with Dovecot and Postfix on Almalinux -","isPartOf":{"@id":"https:\/\/truehost.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-a-mail-server-with-dovecot-and-postfix\/#primaryimage"},"image":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-a-mail-server-with-dovecot-and-postfix\/#primaryimage"},"thumbnailUrl":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-553.png","datePublished":"2024-10-18T06:37:39+00:00","dateModified":"2024-11-20T11:44:20+00:00","breadcrumb":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-a-mail-server-with-dovecot-and-postfix\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-a-mail-server-with-dovecot-and-postfix\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-a-mail-server-with-dovecot-and-postfix\/#primaryimage","url":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-553.png","contentUrl":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2024\/10\/image-553.png"},{"@type":"BreadcrumbList","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-configure-a-mail-server-with-dovecot-and-postfix\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/truehost.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Configure a Mail Server with Dovecot and Postfix on Almalinux"}]},{"@type":"WebSite","@id":"https:\/\/truehost.com\/support\/#website","url":"https:\/\/truehost.com\/support\/","name":"","description":"Help In a Click","publisher":{"@id":"https:\/\/truehost.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/truehost.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/truehost.com\/support\/#organization","name":"Truehost Kenya","url":"https:\/\/truehost.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/truehost.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2026\/04\/cropped-image_2026-04-16_174808866.png","contentUrl":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2026\/04\/cropped-image_2026-04-16_174808866.png","width":240,"height":48,"caption":"Truehost Kenya"},"image":{"@id":"https:\/\/truehost.com\/support\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/15408","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/comments?post=15408"}],"version-history":[{"count":26,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/15408\/revisions"}],"predecessor-version":[{"id":17474,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/15408\/revisions\/17474"}],"wp:attachment":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/media?parent=15408"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_category?post=15408"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_tag?post=15408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}