{"id":523,"date":"2011-02-23T22:15:17","date_gmt":"2011-02-23T19:15:17","guid":{"rendered":"http:\/\/sandalov.org\/blog\/?p=523"},"modified":"2011-07-13T16:24:13","modified_gmt":"2011-07-13T12:24:13","slug":"using-gmail-as-postfix-relay-in-ubuntu","status":"publish","type":"post","link":"https:\/\/sandalov.org\/blog\/523\/","title":{"rendered":"Using Gmail as Postfix relay in Ubuntu"},"content":{"rendered":"<div class=\"2d836d85a73757df15d0de19d7bef594\" data-index=\"1\" style=\"float: none; margin:10px 0 10px 0; text-align:center;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"ca-pub-2287684400845931\";\r\n\/* valerymorozov *\/\r\ngoogle_ad_slot = \"5606708872\";\r\ngoogle_ad_width = 728;\r\ngoogle_ad_height = 90;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n<p>Here\u2019s are consolidated set of instructions for setting up a postfix gmail smarthost on Ubuntu 10.10. In \u201csmarthost\u201d configuration, the local mail transport agent (MTA) routes all mail to another server for delivery. This is useful since frequently you won\u2019t want to try to deliver mail yourself (SPF and\/or blacklisting would likely squash your message as spam).<\/p>\n<ol>\n<li>Install <a href=\"https:\/\/help.ubuntu.com\/community\/Postfix\">Postfix<\/a><\/li>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get install postfix\r\n<\/pre>\n<li>The deb-installer will prompt you to answer a series of questions\n<ul>\n<li>Type of mail server : Satellite System<\/li>\n<li>Mail Name : example.org (the name you want on your outbound mail)<\/li>\n<li>SMTP relay host : smtp.gmail.com<\/li>\n<li>Postmaster : I left this blank<\/li>\n<li>Other destinations : I left this blank<\/li>\n<li>Synchronous Queues : your choice, won\u2019t impact the relaying<\/li>\n<li>Network blocks to allow relay : default (unless you know what your doing)<\/li>\n<li>Mailbox size : your choice, won\u2019t impact relaying<\/li>\n<li>Local address : i left this as \u2018+\u2019<\/li>\n<li>Listen Address : all, your choice<\/li>\n<\/ul>\n<\/li>\n<li>We\u2019re almost done, but need some tweaks in postfix config \/etc\/postfix\/main.cf. Add the following lines to enable TLS and passwords on outbound connections.<\/li>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nsmtp_use_tls=yes\r\nsmtp_sasl_auth_enable = yes\r\nsmtp_sasl_password_maps = hash:\/etc\/postfix\/sasl_passwd\r\nsmtp_sasl_security_options = noanonymous\r\nsmtp_sasl_tls_security_options = noanonymous\r\n<\/pre>\n<li>And create the \/etc\/postfix\/sasl_passwd with one line (replace the user and password with your own)<\/li>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nsmtp.gmail.com some.user@gmail.com:PASSWORD\r\n<\/pre>\n<li>Rebuild the hash:<\/li>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\npostmap \/etc\/postfix\/sasl_passwd\r\n<\/pre>\n<li>Restart postfix:<\/li>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\/etc\/init.d\/postfix restart\r\n<\/pre>\n<li>You can optionally lock down your password file<\/li>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nchmod 640 \/etc\/postfix\/sasl_passwd*\r\nchown postfix.postfix \/etc\/postfix\/sasl_passwd*\r\n<\/pre>\n<\/ol>\n<p>Thats all there is to it. Here\u2019s my <a href=\"http:\/\/www.sandalov.org\/blog\/wp-content\/uploads\/2011\/02\/main.cf\">main.cf<\/a> for reference.<\/p>\n<p style=\"text-align: right;\">via <a href=\"http:\/\/braiden.org\/?p=15\">braiden.org<\/a>, <a href=\"http:\/\/www.techienote.com\/2011\/01\/configuring-postfix-to-relay-email-through-gmail-in-ubuntu.html\">techienote.com<\/a><\/p>\n<div class=\"2d836d85a73757df15d0de19d7bef594\" data-index=\"1\" style=\"float: none; margin:10px 0 10px 0; text-align:center;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"ca-pub-2287684400845931\";\r\n\/* valerymorozov *\/\r\ngoogle_ad_slot = \"5606708872\";\r\ngoogle_ad_width = 728;\r\ngoogle_ad_height = 90;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>Here\u2019s are consolidated set of instructions for setting up a postfix gmail smarthost on Ubuntu 10.10. In \u201csmarthost\u201d configuration, the local mail transport agent (MTA) routes all mail to another server for delivery. This is useful since frequently you won\u2019t want to try to deliver mail yourself (SPF and\/or blacklisting &hellip; <a class=\"continue-reading-link\" href=\"https:\/\/sandalov.org\/blog\/523\/\"> Continue reading <span class=\"meta-nav\">&rarr; <\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[52],"tags":[116,379],"class_list":["post-523","post","type-post","status-publish","format-standard","hentry","category-ubuntu","tag-postfix","tag-ubuntu"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/posts\/523","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/comments?post=523"}],"version-history":[{"count":32,"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/posts\/523\/revisions"}],"predecessor-version":[{"id":767,"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/posts\/523\/revisions\/767"}],"wp:attachment":[{"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/media?parent=523"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/categories?post=523"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/tags?post=523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}