{"id":5731,"date":"2023-05-25T18:16:08","date_gmt":"2023-05-25T18:16:08","guid":{"rendered":"https:\/\/tst-amo.net.ua\/blog\/?p=5731"},"modified":"2023-05-25T19:18:33","modified_gmt":"2023-05-25T19:18:33","slug":"postfix-%d1%82%d0%be%d0%bb%d1%8c%d0%ba%d0%be-%d0%bd%d0%b0-%d0%be%d1%82%d0%bf%d1%80%d0%b0%d0%b2%d0%ba%d1%83-relayhost-smtp-gmail-com","status":"publish","type":"post","link":"https:\/\/tst-amo.net.ua\/blog\/?p=5731","title":{"rendered":"Postfix \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 (relayhost = smtp.gmail.com)"},"content":{"rendered":"<p>\u0412 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 <a href=\"https:\/\/tst-amo.net.ua\/blog\/?p=5705\">\u0442\u0435\u043c\u044b<\/a>. \u041d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0447\u0442\u0443 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443.<\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c<\/p>\n<pre># yum install certbot\r\n# yum install cyrus-sasl-plain \r\n# service postfix restart<\/pre>\n<p>\u041f\u043e\u0440\u0442 25 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d \u0445\u043e\u0441\u0442\u0435\u0440\u043e\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043d\u0430 587.<\/p>\n<pre># mkdir \/etc\/postfix\/sasl\r\n\r\n# cat sasl_passwd \r\n[smtp.gmail.com]:<span style=\"color: #ff0000;\">587<\/span> <span style=\"color: #ff0000;\">user_gmail@gmail.com<\/span>:<span style=\"color: #ff0000;\">__PASSWORD__<\/span>\r\n\r\n# postmap \/etc\/postfix\/sasl\/sasl_passwd<\/pre>\n<pre># chmod 600 sasl_passwd<\/pre>\n<p>\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c main.cf<\/p>\n<pre>myhostname = aws.tst-amo.net.ua \r\ninet_protocols = ipv4\r\nmydestination = $myhostname, localhost.$mydomain, localhost\r\nmynetworks = 127.0.0.0\/8\r\n\r\nrelayhost = [smtp.gmail.com]:587\r\n\r\n# Enables SASL authentication for postfix\r\nsmtp_sasl_auth_enable = yes\r\n# Disallow methods that allow anonymous authentication smtp_sasl_security_options = noanonymous\r\n# Location of sasl_passwd we saved\r\nsmtp_sasl_password_maps = hash:\/etc\/postfix\/sasl\/sasl_passwd\r\n# Enable STARTTLS encryption for SMTP\r\nsmtp_tls_security_level = encrypt\r\n# Location of CA certificates for TLS\r\nsmtp_tls_CAfile = \/etc\/ssl\/certs\/ca-bundle.crt\r\nsmtp_sasl_security_options = noanonymous\r\n\r\n# TLS parameters\r\nsmtpd_tls_cert_file=\/etc\/letsencrypt\/live\/aws.tst-amo.net.ua\/fullchain.pem\r\nsmtpd_tls_key_file=\/etc\/letsencrypt\/live\/aws.tst-amo.net.ua\/privkey.pem\r\nsmtp_use_tls=yes\r\nsmtpd_tls_session_cache_database = btree:${data_directory}\/smtpd_scache\r\nsmtp_tls_session_cache_database = btree:${data_directory}\/smtp_scache<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0412 master.cf \u0440\u0430\u0441\u043a\u043e\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 (\u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c 587 \u043f\u043e\u0440\u0442)<\/p>\n<pre>submission inet n - n - - smtpd<\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c<\/p>\n<pre># echo \"Test Postfix Gmail https:\/\/example.com\" | mail -s \"Postfix Gmail\" <span style=\"color: #ff0000;\">to_user@domen.com<\/span><\/pre>\n<p>https:\/\/medium.com\/yavar\/send-mail-using-postfix-server-bbb08331d39d<\/p>\n<p>https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-22-04<\/p>\n<div class=\"pdfprnt-buttons pdfprnt-buttons-post pdfprnt-bottom-right\"><a href=\"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=wpv2posts5731&print=pdf\" class=\"pdfprnt-button pdfprnt-button-pdf\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/tst-amo.net.ua\/blog\/wp-content\/plugins\/pdf-print\/images\/pdf.png\" alt=\"image_pdf\" title=\"View PDF\" \/><\/a><a href=\"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=wpv2posts5731&print=print\" class=\"pdfprnt-button pdfprnt-button-print\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/tst-amo.net.ua\/blog\/wp-content\/plugins\/pdf-print\/images\/print.png\" alt=\"image_print\" title=\"Print Content\" \/><\/a><\/div>","protected":false},"excerpt":{"rendered":"<p>\u0412 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0442\u0435\u043c\u044b. \u041d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0447\u0442\u0443 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c # yum install certbot # yum install cyrus-sasl-plain # service postfix restart \u041f\u043e\u0440\u0442 25 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d \u0445\u043e\u0441\u0442\u0435\u0440\u043e\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043d\u0430 587. # mkdir \/etc\/postfix\/sasl # cat sasl_passwd [smtp.gmail.com]:587 user_gmail@gmail.com:__PASSWORD__ # postmap \/etc\/postfix\/sasl\/sasl_passwd # chmod 600 sasl_passwd \u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c main.cf myhostname = aws.tst-amo.net.ua inet_protocols = ipv4 &#8230;<\/p>\n<p><a href=\"https:\/\/tst-amo.net.ua\/blog\/?p=5731\" class=\"more-link\">Continue reading &lsquo;Postfix \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 (relayhost = smtp.gmail.com)&rsquo; &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48,385,47,7,70],"tags":[],"class_list":["post-5731","post","type-post","status-publish","format-standard","hentry","category-centos","category-gmail","category-linux","category-mail","category-postfix"],"_links":{"self":[{"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5731"}],"collection":[{"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5731"}],"version-history":[{"count":11,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5731\/revisions"}],"predecessor-version":[{"id":5743,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5731\/revisions\/5743"}],"wp:attachment":[{"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}