{"id":27919,"date":"2024-06-10T04:20:02","date_gmt":"2024-06-10T04:20:02","guid":{"rendered":"https:\/\/green.cloud\/docs\/docs\/greencloud-documents\/linux-operating-systems\/how-to-install-and-configure-postfix-on-ubuntu-22-04\/"},"modified":"2026-01-19T00:45:45","modified_gmt":"2026-01-19T00:45:45","slug":"how-to-install-and-configure-postfix-on-ubuntu-22-04","status":"publish","type":"docs","link":"https:\/\/green.cloud\/docs\/how-to-install-and-configure-postfix-on-ubuntu-22-04\/","title":{"rendered":"How to Install and Configure Postfix on Ubuntu 22.04"},"content":{"rendered":"<p>In this guide we\u2019ll look at how you can configure Postfix MTA as a send-only SMTP server on Ubuntu 22.04, meaning it doesn\u2019t receive and process emails. Its job is only to act as a Local mail transfer agent. Postfix is a popular open-source Mail Transfer Agent (MTA) used in Linux and Unix environments.<\/p>\n<p>A send-only mail server is useful especially when used in scripting, e.g. having a <em>cron<\/em>\u00a0job that sends an email about the status of its execution, or an application that sends an email to you when certain events happen.<span id=\"ezoic-pub-ad-placeholder-165\" class=\"ezoic-adpicker-ad\" data-ezoic-video-excluded=\"1\"><\/span><\/p>\n<p><iframe title=\"How to install and configure Postfix on Ubuntu 22.04 | VPS Tutorial\" width=\"1170\" height=\"658\" src=\"https:\/\/www.youtube.com\/embed\/syxd-QDSLSk?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<h2 class=\"wp-block-heading\">Configure Postfix as a Send-Only SMTP Server on Ubuntu<\/h2>\n<p>Installing and configuring\u00a0Postfix as a Send-Only SMTP Server on Ubuntu is an easy process. Start by updating your system:<\/p>\n<pre class=\"wp-block-code\"><code>apt update<\/code><\/pre>\n<p>Also, set a hostname for the server so that emails will show a from address with a valid domain section.<span id=\"ezoic-pub-ad-placeholder-173\" class=\"ezoic-adpicker-ad\" data-ezoic-video-excluded=\"1\"><\/span><\/p>\n<pre class=\"wp-block-code\"><code>hostnamectl set-hostname <mark class=\"has-inline-color has-vivid-purple-color\">greencloud.example.com<\/mark><\/code><\/pre>\n<p>Download mailutils which installs Postfix and other mail utils for you:<\/p>\n<pre class=\"wp-block-code\"><code>apt install mailutils<\/code><\/pre>\n<p>As the package installs, you\u2019ll be asked to select an option on screen for your mail server. For\u00a0<strong>\u201d\u00a0General type of email configuration\u201d\u00a0<\/strong>window, select\u00a0<strong>Internet site\u00a0<\/strong>and click\u00a0<strong>OK\u00a0<\/strong>button<span id=\"ezoic-pub-ad-placeholder-167\" class=\"ezoic-adpicker-ad\" data-ezoic-video-excluded=\"1\"><\/span><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-3343\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2024\/06\/Screenshot_1-4.png\" alt=\"\" width=\"1023\" height=\"269\" \/><\/p>\n<p>The next page will ask you to set your Mail server name, this can be a domain or server hostname with an A record.<\/p>\n<p><img decoding=\"async\" class=\"wp-image-3343\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2024\/06\/Screenshot_2-4.png\" alt=\"\" width=\"1023\" height=\"269\" \/><\/p>\n<p>Select\u00a0<strong>OK\u00a0<\/strong>to save the settings and finish the installation.<\/p>\n<h3 class=\"wp-block-heading\">Configure Postfix MTA Server<\/h3>\n<p>Edit the Postfix configuration file <code>\/etc\/postfix\/main.cf<\/code> to ensure it is configured as send-only ( Only relaying emails from the local server).<span id=\"ezoic-pub-ad-placeholder-168\" class=\"ezoic-adpicker-ad\" data-ezoic-video-excluded=\"1\"><\/span><\/p>\n<p>Set Postfix to listen on the\u00a0<code>127.0.0.1<\/code>loopback interface. The default setting is\u00a0to listen on all interfaces.<span id=\"ezoic-pub-ad-placeholder-185\" class=\"ezoic-adpicker-ad\" data-ezoic-video-excluded=\"1\"><\/span><\/p>\n<pre class=\"wp-block-code\"><code>inet_interfaces = loopback-only<\/code><\/pre>\n<p>Also, set\u00a0<code>myhostname<\/code>\u00a0to your Server FQDN<\/p>\n<pre class=\"wp-block-code\"><code>myhostname=<mark class=\"has-inline-color has-pale-cyan-blue-color\">myserver.example.com<\/mark><\/code><\/pre>\n<p>See screenshot below<\/p>\n<p><img decoding=\"async\" class=\"wp-image-3343\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2024\/06\/Screenshot_3-4.png\" alt=\"\" width=\"1023\" height=\"269\" \/><\/p>\n<p>Restart the Postfix service for it to pick the new changes:<span id=\"ezoic-pub-ad-placeholder-169\" class=\"ezoic-adpicker-ad\" data-ezoic-video-excluded=\"1\"><\/span><\/p>\n<pre class=\"wp-block-code\"><code>systemctl restart postfix<\/code><\/pre>\n<p>You have successfully installed and configured Postfix as a Send-only MTA server. To test email delivery, use the <code>mail<\/code>\u00a0command like below<\/p>\n<pre class=\"wp-block-code\"><code>echo \"Postfix Send-Only Server\" | mail -s \"Postfix Testing\" <mark class=\"has-inline-color has-pale-cyan-blue-color\">tamtran@green.cloud<\/mark><\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3343\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2024\/06\/Screenshot_6-3.png\" alt=\"\" width=\"1023\" height=\"269\" \/><br \/>\nYou can also load existing data to\u00a0<code>mail<\/code><\/p>\n<pre class=\"wp-block-code\"><code>mail -s \"Mail Subject\" <mark class=\"has-inline-color has-pale-cyan-blue-color\">tamtran@green.cloud<\/mark> &lt; \/root\/green1\/file.txt<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3343\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2024\/06\/Screenshot_7-2.png\" alt=\"\" width=\"1023\" height=\"269\" \/><br \/>\nThis will send an email with the content loaded from\u00a0<code>\/home\/jmutai\/file.txt<\/code><br \/>\nin the message section.<span id=\"ezoic-pub-ad-placeholder-186\" class=\"ezoic-adpicker-ad\" data-ezoic-video-excluded=\"1\"><\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide we\u2019ll look at how you can configure Postfix MTA as a send-only SMTP server on Ubuntu 22.04, meaning it doesn\u2019t receive and process emails. Its job is only to act as a Local mail transfer agent. Postfix is a popular open-source Mail Transfer Agent (MTA) used in Linux and Unix environments. A [&hellip;]<\/p>\n","protected":false},"author":15,"featured_media":0,"parent":17817,"menu_order":329,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-27919","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 Install and Configure Postfix on Ubuntu 22.04 - 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-install-and-configure-postfix-on-ubuntu-22-04\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install and Configure Postfix on Ubuntu 22.04 - GreenCloud Documentation\" \/>\n<meta property=\"og:description\" content=\"In this guide we\u2019ll look at how you can configure Postfix MTA as a send-only SMTP server on Ubuntu 22.04, meaning it doesn\u2019t receive and process emails. Its job is only to act as a Local mail transfer agent. Postfix is a popular open-source Mail Transfer Agent (MTA) used in Linux and Unix environments. A [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/green.cloud\/docs\/how-to-install-and-configure-postfix-on-ubuntu-22-04\/\" \/>\n<meta property=\"og:site_name\" content=\"GreenCloud Documentation\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-19T00:45:45+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=\"3 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-install-and-configure-postfix-on-ubuntu-22-04\\\/\",\"url\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-and-configure-postfix-on-ubuntu-22-04\\\/\",\"name\":\"How to Install and Configure Postfix on Ubuntu 22.04 - GreenCloud Documentation\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-and-configure-postfix-on-ubuntu-22-04\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-and-configure-postfix-on-ubuntu-22-04\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/green.cloud\\\/docs\\\/wp-content\\\/uploads\\\/2024\\\/06\\\/Screenshot_1-4.png\",\"datePublished\":\"2024-06-10T04:20:02+00:00\",\"dateModified\":\"2026-01-19T00:45:45+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-and-configure-postfix-on-ubuntu-22-04\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-and-configure-postfix-on-ubuntu-22-04\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-and-configure-postfix-on-ubuntu-22-04\\\/#primaryimage\",\"url\":\"\",\"contentUrl\":\"\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-and-configure-postfix-on-ubuntu-22-04\\\/#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 Install and Configure Postfix on Ubuntu 22.04\"}]},{\"@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 Install and Configure Postfix on Ubuntu 22.04 - 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-install-and-configure-postfix-on-ubuntu-22-04\/","og_locale":"en_US","og_type":"article","og_title":"How to Install and Configure Postfix on Ubuntu 22.04 - GreenCloud Documentation","og_description":"In this guide we\u2019ll look at how you can configure Postfix MTA as a send-only SMTP server on Ubuntu 22.04, meaning it doesn\u2019t receive and process emails. Its job is only to act as a Local mail transfer agent. Postfix is a popular open-source Mail Transfer Agent (MTA) used in Linux and Unix environments. A [&hellip;]","og_url":"https:\/\/green.cloud\/docs\/how-to-install-and-configure-postfix-on-ubuntu-22-04\/","og_site_name":"GreenCloud Documentation","article_modified_time":"2026-01-19T00:45:45+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/green.cloud\/docs\/how-to-install-and-configure-postfix-on-ubuntu-22-04\/","url":"https:\/\/green.cloud\/docs\/how-to-install-and-configure-postfix-on-ubuntu-22-04\/","name":"How to Install and Configure Postfix on Ubuntu 22.04 - GreenCloud Documentation","isPartOf":{"@id":"https:\/\/green.cloud\/docs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/green.cloud\/docs\/how-to-install-and-configure-postfix-on-ubuntu-22-04\/#primaryimage"},"image":{"@id":"https:\/\/green.cloud\/docs\/how-to-install-and-configure-postfix-on-ubuntu-22-04\/#primaryimage"},"thumbnailUrl":"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2024\/06\/Screenshot_1-4.png","datePublished":"2024-06-10T04:20:02+00:00","dateModified":"2026-01-19T00:45:45+00:00","breadcrumb":{"@id":"https:\/\/green.cloud\/docs\/how-to-install-and-configure-postfix-on-ubuntu-22-04\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/green.cloud\/docs\/how-to-install-and-configure-postfix-on-ubuntu-22-04\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/green.cloud\/docs\/how-to-install-and-configure-postfix-on-ubuntu-22-04\/#primaryimage","url":"","contentUrl":""},{"@type":"BreadcrumbList","@id":"https:\/\/green.cloud\/docs\/how-to-install-and-configure-postfix-on-ubuntu-22-04\/#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 Install and Configure Postfix on Ubuntu 22.04"}]},{"@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\/27919","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\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/comments?post=27919"}],"version-history":[{"count":10,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs\/27919\/revisions"}],"predecessor-version":[{"id":29269,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs\/27919\/revisions\/29269"}],"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=27919"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/doc_tag?post=27919"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}