{"id":5796,"date":"2020-09-02T14:05:31","date_gmt":"2020-09-02T08:35:31","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=5796"},"modified":"2020-09-02T19:11:08","modified_gmt":"2020-09-02T13:41:08","slug":"setup-postfix-with-mailgun-for-reliable-e-mail-delivery-on-ubuntu","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/setup-postfix-with-mailgun-for-reliable-e-mail-delivery-on-ubuntu\/","title":{"rendered":"Setup Postfix with Mailgun for reliable E-Mail Delivery on Ubuntu"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Setup Postfix with Mailgun for reliable E-Mail Delivery on Ubuntu<\/h4>\n\n\n\n<h4 class=\"wp-block-heading\">Date: 24-08-2020<\/h4>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Install Postfix<\/strong>:<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Postfix&nbsp;is a mail transfer agent (MTA) which is the responsible software for delivering &amp; receiving emails, it\u2019s essential in order to create a complete mail server.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 1:<\/strong>  Login to the server by using ssh.<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">As the root user, you can install postfix using below command.<br>    <code><strong>#  apt-get install postfix<\/strong><\/code><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.jamroom.net\/documentation\/image\/doc_image\/1350\/1280\/_v=cec181385476267\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now enter the fully qualified domain name that you want to use for send and receive mails.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"800\" height=\"600\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/08\/Set-Postfix-Mail-Domain.png\" alt=\"\" class=\"wp-image-5797\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/08\/Set-Postfix-Mail-Domain.png 800w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/08\/Set-Postfix-Mail-Domain-300x225.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/08\/Set-Postfix-Mail-Domain-768x576.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/08\/Set-Postfix-Mail-Domain-400x300.png 400w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Once the FQDN set, you\u2019ve to restart the Postfix mail server by using the below command.<br><code><strong># service postfix restart<\/strong><\/code><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><br><strong>Step 2:<\/strong> Signup for A Free Mailgun Account.<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The Mailgun is a set of powerful APIs that allow you to send, receive, and track email.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first 10,000 emails each month via Mailgun are free &#8211; after that, it is just 50 cents for every 1,000. You can signup for an account by using the following link.<br><a href=\"http:\/\/www.mailgun.com\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.mailgun.com\/<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once signed up, go to your Mailgun Control Panel.<br><a href=\"https:\/\/mailgun.com\/cp\" target=\"_blank\" rel=\"noopener\">https:\/\/mailgun.com\/cp<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Click on the domains tab then select the Add Domain button.<br>Enter your domain name and press the Create Domain button at the bottom of the form. This will create your domain in Mailgun.<br>Click on the Domains tab again, and then click on your new domain in the domains list. This will take you into the details page for your new domain.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 3: <\/strong>Configuring Postfix to use Mailgun as a Relay Host.<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">You can find your SMTP password on the domain page. This is the password we are going to need when configuring Postfix to send our email through Mailgun.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Edit the Postfix main.cf file.<br><code><strong># nano \/etc\/postfix\/main.cf<\/strong><\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following to the bottom of the file:<br><code>relayhost = smtp.mailgun.org smtp_sasl_auth_enable = yes smtp_sasl_password_maps = static:postmaster@pheonixsolutions.com:password smtp_sasl_security_options = noanonymous<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Replace:<\/strong> <br>&#8211;&nbsp;<strong>pheonixsolutions.com<\/strong>&nbsp;with your domain name name <br>&#8211;&nbsp;<strong>password<\/strong>&nbsp;with the password you just grabbed from the Mailgun control panel.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Save your changes and restart postfix:<br><code><strong># service postfix restart<\/strong><\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Your Postfix will now send all email out through Mailgun.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setup Postfix with Mailgun for reliable E-Mail Delivery on Ubuntu Date: 24-08-2020 Install Postfix: Postfix&nbsp;is a mail transfer agent (MTA) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1019],"tags":[198,171],"class_list":["post-5796","post","type-post","status-publish","format-standard","hentry","category-cloud-aws","tag-mailserver","tag-postfix","psol-cat-cloud-aws"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-1vu","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5796","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=5796"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5796\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=5796"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=5796"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=5796"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}