{"id":87,"date":"2021-09-13T15:25:23","date_gmt":"2021-09-13T08:25:23","guid":{"rendered":"http:\/\/warawich.com\/?p=87"},"modified":"2022-12-19T12:39:38","modified_gmt":"2022-12-19T05:39:38","slug":"use-gmail-smtp-for-relay-server-on-postfix","status":"publish","type":"post","link":"https:\/\/warawich.com\/index.php\/2021\/09\/13\/use-gmail-smtp-for-relay-server-on-postfix\/","title":{"rendered":"Use Gmail SMTP for relay server on Postfix"},"content":{"rendered":"\n<figure class=\"wp-block-embed-wordpress wp-block-embed is-type-wp-embed is-provider-linux-scripts-hub\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"X3uqNbKUj2\"><a href=\"https:\/\/linuxscriptshub.com\/configure-smtp-with-gmail-using-postfix\/\">Configure SMTP with Gmail Using Postfix<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"\u201cConfigure SMTP with Gmail Using Postfix\u201d \u2014 Linux Scripts Hub\" src=\"https:\/\/linuxscriptshub.com\/configure-smtp-with-gmail-using-postfix\/embed\/#?secret=X3uqNbKUj2\" data-secret=\"X3uqNbKUj2\" width=\"525\" height=\"296\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<ol class=\"wp-block-list\"><li>Install Postfix on your server:<ul><li>On Debian\/Ubuntu systems, you can use the following command: <code>sudo apt-get install postfix<\/code><\/li><li>On CentOS\/Red Hat systems, you can use the following command: <code>sudo yum install postfix<\/code><\/li><\/ul><\/li><li>Once Postfix is installed, open the main configuration file using your favorite text editor: <code>sudo nano \/etc\/postfix\/main.cf<\/code><\/li><li>Find the following lines in the configuration file and modify them as follows:<ul><li><code>relayhost = [smtp.gmail.com]:587<\/code><\/li><li><code>smtp_sasl_auth_enable = yes<\/code><\/li><li><code>smtp_sasl_security_options = noanonymous<\/code><\/li><li><code>smtp_sasl_password_maps = hash:\/etc\/postfix\/sasl_passwd<\/code><\/li><\/ul><\/li><li>Next, create a new file called <code>sasl_passwd<\/code> in the <code>\/etc\/postfix<\/code> directory: <code>sudo nano \/etc\/postfix\/sasl_passwd<\/code><\/li><li>Add the following line to the <code>sasl_passwd<\/code> file, replacing <code>user@gmail.com<\/code> and <code>password<\/code> with your Gmail address and password: <code>[smtp.gmail.com]:587 user@gmail.com:password<\/code><\/li><li>Save and close the <code>sasl_passwd<\/code> file, then run the following command to create a hashed version of the file: <code>sudo postmap \/etc\/postfix\/sasl_passwd<\/code><\/li><li>Finally, restart the Postfix service to apply the changes: <code>sudo service postfix restart<\/code><\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">You should now be able to use Gmail&#8217;s SMTP server to send emails through Postfix.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install Postfix on your server: On Debian\/Ubuntu systems, you can use the following command: sudo apt-get install postfix On CentOS\/Red Hat systems, you can use the following command: sudo yum install postfix Once Postfix is installed, open the main configuration file using your favorite text editor: sudo nano \/etc\/postfix\/main.cf Find the following lines in the &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/warawich.com\/index.php\/2021\/09\/13\/use-gmail-smtp-for-relay-server-on-postfix\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Use Gmail SMTP for relay server on Postfix&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-87","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/warawich.com\/index.php\/wp-json\/wp\/v2\/posts\/87","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/warawich.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/warawich.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/warawich.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/warawich.com\/index.php\/wp-json\/wp\/v2\/comments?post=87"}],"version-history":[{"count":3,"href":"https:\/\/warawich.com\/index.php\/wp-json\/wp\/v2\/posts\/87\/revisions"}],"predecessor-version":[{"id":138,"href":"https:\/\/warawich.com\/index.php\/wp-json\/wp\/v2\/posts\/87\/revisions\/138"}],"wp:attachment":[{"href":"https:\/\/warawich.com\/index.php\/wp-json\/wp\/v2\/media?parent=87"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/warawich.com\/index.php\/wp-json\/wp\/v2\/categories?post=87"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/warawich.com\/index.php\/wp-json\/wp\/v2\/tags?post=87"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}