{"id":7307,"date":"2021-05-04T07:41:58","date_gmt":"2021-05-04T07:41:58","guid":{"rendered":"https:\/\/green.cloud\/docs\/docly-documentation\/content\/how-to-configure-smtp-server-in-linux\/"},"modified":"2026-01-19T00:45:43","modified_gmt":"2026-01-19T00:45:43","slug":"how-to-configure-smtp-server-on-linux","status":"publish","type":"docs","link":"https:\/\/green.cloud\/docs\/how-to-configure-smtp-server-on-linux\/","title":{"rendered":"How to Configure SMTP Server on Linux"},"content":{"rendered":"<header class=\"entry-header\"><span style=\"color: #6b707f; font-size: 16px;\">Email servers are now a must-have for small, medium, and large enterprises. They enable easy and efficient traffic control. Besides, having your email servers ensure that you can independently define or set your rules to meet your objectives. These advantages ensure that you manage your servers more efficiently and in a cleaner manner.<\/span><\/header>\n<div class=\"entry-content\">\n<div id=\"wpbody\">\n<p>SMTP is your ideal protocol for email server management. Commonly known as Simple Mail Transfer Protocol, SMTP stands out as a standard internet communication protocol designed and used for electronic mail transmission.It routes emails by using third-party service providers to send emails through servers. This protocol comes in handy for companies or enterprises with large volumes of emails. Notably, SMTP has no downtimes, sends emails to your inbox rather than your spam folder, and has an analytics section on the dashboard. Thus, you do not need a lot of time and resources to manage your email servers.<\/p>\n<div id=\"cls-video-container-5Dm6bvSz\" class=\"adthrive\" style=\"text-align: justify;\">\n<div id=\"adthrive-collapse-container\" class=\"adthrive-player-container adthrive-collapse-player\">\n<div id=\"adthrive-collapse-position\" class=\"adthrive-player-position adthrive-player-without-wrapper-text\">\n<div id=\"5Dm6bvSz\" class=\"jwplayer jw-reset jw-state-paused jw-stretch-uniform jw-flag-aspect-mode jw-breakpoint-4 jw-flag-user-inactive\" tabindex=\"0\" role=\"application\" aria-label=\"Video Player\" aria-describedby=\"jw-5Dm6bvSz-shortcuts-tooltip-explanation\">\n<div class=\"jw-wrapper jw-reset\">\n<div class=\"jw-controls jw-reset\">\n<div class=\"jw-controlbar jw-reset\">\n<div class=\"jw-reset jw-button-container\">\n<div class=\"jw-icon jw-icon-inline jw-button-color jw-reset jw-icon-fullscreen\" tabindex=\"0\" role=\"button\" aria-label=\"Fullscreen\">\n<div class=\"jw-reset-text jw-tooltip jw-tooltip-fullscreen\" dir=\"auto\">\n<div class=\"jw-text\">This article demonstrates how you can set up an STMP server on Ubuntu 22.04. The same steps apply if your machine runs on Ubuntu 20.04.<\/div>\n<div>\n<p><iframe title=\"How to configure SMTP Server on Linux | VPS Tutorial\" width=\"1170\" height=\"658\" src=\"https:\/\/www.youtube.com\/embed\/Tq7q_pttrDw?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h2 style=\"text-align: justify;\">Step 1: Update Your Server<\/h2>\n<p style=\"text-align: justify;\">The first step is to log in to your server and update it. You can log in using SSH, ensuring your server runs on the latest Ubuntu packages. Instead of SSH, you can also use\u00a0<strong>CTRL+ALT+T<\/strong>\u00a0to access your server. You can then execute the following command:<\/p>\n<pre>apt update<\/pre>\n<h2 style=\"text-align: justify;\">Step 2: Install Postfix<\/h2>\n<p style=\"text-align: justify;\">Once your server is up to date, install Postfix using the following command to install the email utilities:<\/p>\n<div class=\"slick-inline-search-panel\" style=\"text-align: justify;\" data-config=\"in-content-DCM\">\n<div id=\"container\">\n<pre>apt install postfix<\/pre>\n<p>A Postfix configuration window will pop up in the process of installation. The window will be shown below:<\/p>\n<\/div>\n<\/div>\n<p style=\"text-align: justify;\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-242317 entered lazyloaded\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/05\/Screenshot_4.png\" data-ll-status=\"loaded\" \/><\/p>\n<div id=\"AdThrive_Content_3_desktop\" class=\"adthrive-ad adthrive-content adthrive-content-3 adthrive-ad-cls\" style=\"text-align: justify;\" data-google-query-id=\"CITgmOK28f4CFQECXAodiYsL8g\">\n<div id=\"google_ads_iframe_\/18190176,22488008280\/AdThrive_Content_3\/5c9b6001b80bec0dfaf0b493_0__container__\"><\/div>\n<\/div>\n<p style=\"text-align: justify;\">The configuration comes with Internet Site as the default mail configuration type. That is the recommended type of configuration for this particular purpose. Thus, you should press\u00a0<strong>TAB<\/strong>, select\u00a0<strong>OK<\/strong>, and then press\u00a0<strong>ENTER<\/strong>.<\/p>\n<h2 style=\"text-align: justify;\">Step 3: Configure Postfix<\/h2>\n<p style=\"text-align: justify;\">Now, configure Postfix to enable it to send and receive emails from the running server. In this case, the running server is the localhost. You can achieve this configuration process by setting up Postfix to listen exclusively on the loopback interface. This interface is a virtual network used by servers to communicate internally.<\/p>\n<p style=\"text-align: justify;\">Make the relevant modifications by editing the primary Postfix configuration file (main.cf), which exists in etc\/postfix. However, back up the file before you make any edits. You may need the original version.<\/p>\n<pre>cp \/etc\/postfix\/main.cf \/etc\/postfix\/main.cf.backup<\/pre>\n<p style=\"text-align: justify;\">You can then access the file using the following commands:<\/p>\n<pre>nano \/etc\/postfix\/main.cf<\/pre>\n<p style=\"text-align: justify;\">Find the following lines from the file:<\/p>\n<pre>mailbox_size_limit = 0\r\nrecipient_delimiter = +\r\ninet_interfaces = all<\/pre>\n<p style=\"text-align: justify;\">Focus on inet_interfaces and set its value to loopback-only, as indicated below.<\/p>\n<pre>mailbox_size_limit = 0\r\nrecipient_delimiter = +\r\ninet_interfaces =\u00a0<span style=\"color: #ff0000;\">loopback-only<\/span><\/pre>\n<h2 style=\"text-align: justify;\">Step 4: Apply Changes and Start the Postfix Server<\/h2>\n<p style=\"text-align: justify;\">Ensure that you save the file once you make the necessary changes in the Postfix configuration file. You can then enable Postfix and start it using the following utilities:<\/p>\n<div id=\"AdThrive_Content_5_desktop\" class=\"adthrive-ad adthrive-content adthrive-content-5 adthrive-ad-cls\" style=\"text-align: justify;\" data-google-query-id=\"CKTF7uK28f4CFcZEwgUd4aYHIQ\">\n<pre id=\"google_ads_iframe_\/18190176,22488008280\/AdThrive_Content_5\/5c9b6001b80bec0dfaf0b493_0__container__\">systemctl enable postfix\r\nsystemctl start postfix<\/pre>\n<\/div>\n<h2 style=\"text-align: justify;\">Step 5: Configure Firewall<\/h2>\n<p style=\"text-align: justify;\">The firewall may restrict Postfix. You can allow all Postfix functions in the firewall using the following commands:<\/p>\n<pre>ufw allow Postfix\r\n\r\nufw allow \"Postfix SMTPS\"\r\n\r\nufw allow \"Postfix Submission\"<\/pre>\n<h2 style=\"text-align: justify;\">Step 6: Test the STMP Server<\/h2>\n<p style=\"text-align: justify;\">Use Telnet to confirm if the server is functioning properly. The following command should help:<\/p>\n<pre>telnet VPS_install_Postfix 25<\/pre>\n<p style=\"text-align: justify;\">A perfectly working Postfix should return the following results:<\/p>\n<p style=\"text-align: justify;\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-242325 entered lazyloaded\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/05\/Screenshot_5-1.png\" data-ll-status=\"loaded\" \/><\/p>\n<div id=\"AdThrive_Content_6_desktop\" class=\"adthrive-ad adthrive-content adthrive-content-6 adthrive-ad-cls\" style=\"text-align: justify;\" data-google-query-id=\"CKriiOO28f4CFcYHXAodSWECpQ\">\n<div id=\"google_ads_iframe_\/18190176,22488008280\/AdThrive_Content_6\/5c9b6001b80bec0dfaf0b493_0__container__\"><\/div>\n<\/div>\n<p style=\"text-align: justify;\">Proceed to install the mail-sending packages of Postfix. This is possible using the following command:<\/p>\n<pre>apt install bsd-mailx<\/pre>\n<p style=\"text-align: justify;\">Run the following command once the installation is complete. The utility should help finish up the setup process.<\/p>\n<p style=\"text-align: justify;\">Use the\u00a0<code>mailx<\/code>\u00a0command to send a test message to a real email account you use every day.<\/p>\n<pre><code>mailx <mark>your_real_email_address@example.com<\/mark>\r\n<\/code><\/pre>\n<p style=\"text-align: justify;\">When prompted, enter\u00a0<code>test<\/code>\u00a0or whatever you want for a subject, and then press\u00a0<code>ENTER<\/code>.<\/p>\n<pre><code>Subject: <mark>test<\/mark>\r\n<\/code><\/pre>\n<p style=\"text-align: justify;\">You\u2019ll then be presented with just a cursor and the ability to write the body of your test email. Just write the single word\u00a0<code>test<\/code>\u00a0again and press\u00a0<code>ENTER<\/code>\u00a0again.<\/p>\n<pre><code>test\r\n<\/code><\/pre>\n<p style=\"text-align: justify;\">You need to tell\u00a0<code>mailx<\/code>\u00a0that you\u2019re done writing your message; to do that we have to end the message with a single\u00a0<code>.<\/code>\u00a0and press\u00a0<code>ENTER<\/code>\u00a0one final time. You\u2019ll immediately see\u00a0<code>EOT<\/code>\u00a0as confirmation of that.<\/p>\n<pre><code>.\r\nEOT<\/code><\/pre>\n<p style=\"text-align: justify;\">When testing, please feed in your actual email address where necessary.<\/p>\n<h2 style=\"text-align: justify;\">Conclusion<\/h2>\n<p style=\"text-align: justify;\">The tutorial provided a step-by-step guide on how to set up an STMP server with Postfix. As you probably know, a Postfix server allows the implementation of the SMTP protocol to help manage mail sending. It is fast, easy to configure, and incredibly secure hence popular among enterprises that handle bulk emails.<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Email servers are now a must-have for small, medium, and large enterprises. They enable easy and efficient traffic control. Besides, having your email servers ensure that you can independently define or set your rules to meet your objectives. These advantages ensure that you manage your servers more efficiently and in a cleaner manner. SMTP is [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"parent":17817,"menu_order":233,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-7307","docs","type-docs","status-publish","hentry","no-post-thumbnail"],"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 SMTP Server on Linux - GreenCloud Documentation<\/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:\/\/green.cloud\/docs\/how-to-configure-smtp-server-on-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Configure SMTP Server on Linux - GreenCloud Documentation\" \/>\n<meta property=\"og:description\" content=\"Email servers are now a must-have for small, medium, and large enterprises. They enable easy and efficient traffic control. Besides, having your email servers ensure that you can independently define or set your rules to meet your objectives. These advantages ensure that you manage your servers more efficiently and in a cleaner manner. SMTP is [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/green.cloud\/docs\/how-to-configure-smtp-server-on-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"GreenCloud Documentation\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-19T00:45:43+00:00\" \/>\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=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-configure-smtp-server-on-linux\\\/\",\"url\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-configure-smtp-server-on-linux\\\/\",\"name\":\"How to Configure SMTP Server on Linux - GreenCloud Documentation\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-configure-smtp-server-on-linux\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-configure-smtp-server-on-linux\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/green.cloud\\\/docs\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/Screenshot_4.png\",\"datePublished\":\"2021-05-04T07:41:58+00:00\",\"dateModified\":\"2026-01-19T00:45:43+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-configure-smtp-server-on-linux\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-configure-smtp-server-on-linux\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-configure-smtp-server-on-linux\\\/#primaryimage\",\"url\":\"https:\\\/\\\/green.cloud\\\/docs\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/Screenshot_4.png\",\"contentUrl\":\"https:\\\/\\\/green.cloud\\\/docs\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/Screenshot_4.png\",\"width\":525,\"height\":395},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-configure-smtp-server-on-linux\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/green.cloud\\\/docs\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"GreenCloud Documents\",\"item\":\"https:\\\/\\\/green.cloud\\\/docs\\\/docs\\\/greencloud-documents\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Linux Operating Systems\",\"item\":\"https:\\\/\\\/green.cloud\\\/docs\\\/linux-operating-systems\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"How to Configure SMTP Server on Linux\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/#website\",\"url\":\"https:\\\/\\\/green.cloud\\\/docs\\\/\",\"name\":\"GreenCloud Documentation\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/green.cloud\\\/docs\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Configure SMTP Server on Linux - GreenCloud Documentation","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:\/\/green.cloud\/docs\/how-to-configure-smtp-server-on-linux\/","og_locale":"en_US","og_type":"article","og_title":"How to Configure SMTP Server on Linux - GreenCloud Documentation","og_description":"Email servers are now a must-have for small, medium, and large enterprises. They enable easy and efficient traffic control. Besides, having your email servers ensure that you can independently define or set your rules to meet your objectives. These advantages ensure that you manage your servers more efficiently and in a cleaner manner. SMTP is [&hellip;]","og_url":"https:\/\/green.cloud\/docs\/how-to-configure-smtp-server-on-linux\/","og_site_name":"GreenCloud Documentation","article_modified_time":"2026-01-19T00:45:43+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/green.cloud\/docs\/how-to-configure-smtp-server-on-linux\/","url":"https:\/\/green.cloud\/docs\/how-to-configure-smtp-server-on-linux\/","name":"How to Configure SMTP Server on Linux - GreenCloud Documentation","isPartOf":{"@id":"https:\/\/green.cloud\/docs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/green.cloud\/docs\/how-to-configure-smtp-server-on-linux\/#primaryimage"},"image":{"@id":"https:\/\/green.cloud\/docs\/how-to-configure-smtp-server-on-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/05\/Screenshot_4.png","datePublished":"2021-05-04T07:41:58+00:00","dateModified":"2026-01-19T00:45:43+00:00","breadcrumb":{"@id":"https:\/\/green.cloud\/docs\/how-to-configure-smtp-server-on-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/green.cloud\/docs\/how-to-configure-smtp-server-on-linux\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/green.cloud\/docs\/how-to-configure-smtp-server-on-linux\/#primaryimage","url":"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/05\/Screenshot_4.png","contentUrl":"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/05\/Screenshot_4.png","width":525,"height":395},{"@type":"BreadcrumbList","@id":"https:\/\/green.cloud\/docs\/how-to-configure-smtp-server-on-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/green.cloud\/docs\/"},{"@type":"ListItem","position":2,"name":"GreenCloud Documents","item":"https:\/\/green.cloud\/docs\/docs\/greencloud-documents\/"},{"@type":"ListItem","position":3,"name":"Linux Operating Systems","item":"https:\/\/green.cloud\/docs\/linux-operating-systems\/"},{"@type":"ListItem","position":4,"name":"How to Configure SMTP Server on Linux"}]},{"@type":"WebSite","@id":"https:\/\/green.cloud\/docs\/#website","url":"https:\/\/green.cloud\/docs\/","name":"GreenCloud Documentation","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/green.cloud\/docs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs\/7307","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/comments?post=7307"}],"version-history":[{"count":14,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs\/7307\/revisions"}],"predecessor-version":[{"id":20519,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs\/7307\/revisions\/20519"}],"up":[{"embeddable":true,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs\/17817"}],"wp:attachment":[{"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/media?parent=7307"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/doc_tag?post=7307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}