{"id":1693,"date":"2022-08-30T15:18:39","date_gmt":"2022-08-30T15:18:39","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/28\/postfix-wont-deliver-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:18:39","modified_gmt":"2022-08-30T15:18:39","slug":"postfix-wont-deliver-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/postfix-wont-deliver-collection-of-common-programming-errors\/","title":{"rendered":"postfix won&#39;t deliver-Collection of common programming errors"},"content":{"rendered":"<p>I have been setting up an email server based on this tutorial on ubuntu 12.04 with MySQL virtualuser. After having problems with postgray I&#8217;m again in that situation that I don&#8217;t know where should I search to debug my problem properly. Sending email from my servers mailbox to another account is working, for example Gmail. If I answer on than it is not going to be delivered. <strong>MAILER-DAEMON<\/strong> is returning the following unknown user: &#8220;myname&#8221;. the mail.err on dovecot restart<\/p>\n<pre><code>Jan 22 10:54:41 h2004156 dovecot: imap-login: Error: read(anvil) failed: EOF\nJan 22 10:54:41 h2004156 last message repeated 2 times\nJan 22 10:54:41 h2004156 dovecot: auth: Error: read(anvil-auth-penalty) failed: EOF\nJan 22 10:54:41 h2004156 dovecot: auth: Error: net_connect_unix(anvil-auth-penalty) failed: Permission denied\n<\/code><\/pre>\n<p>I have been checking my dovecote-sql.conf.ext everything seems to be all right, the driver is set it to mysql, the user and password queries are there. Maybe here should be somehow checked if the queries are working.<\/p>\n<p>The mail log shows<\/p>\n<pre><code>Jan 22 00:00:35 h2004156 postfix\/qmgr[6881]: DBBC346CE839: from=, size=1887, nrcpt=1 (queue active)\nJan 22 00:00:35 h2004156 postfix\/local[7701]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled\nJan 22 00:00:35 h2004156 amavis[7675]: (07675-01) Passed CLEAN, [74.125.83.43]  -&gt; , Message-ID: , mail_id: K2Wo7uN7Xmlf, Hits: 1.31, size: 1424, queued_as: DBBC346CE839, 1686 ms\nJan 22 00:00:35 h2004156 postfix\/smtp[7696]: 249DD46CE833: to=, relay=127.0.0.1[127.0.0.1]:10024, delay=1.9, delays=0.18\/0.02\/0.01\/1.7, dsn=2.0.0, status=sent (250 2.0.0 from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as DBBC346CE839)\nJan 22 00:00:35 h2004156 postfix\/qmgr[6881]: 249DD46CE833: removed\n<\/code><\/pre>\n<p>postfix\/main.cf<\/p>\n<pre><code># See \/usr\/share\/postfix\/main.cf.dist for a commented, more complete version\n\n# The first text sent to a connecting process.\nsmtpd_banner = $myhostname ESMTP $mail_name\nbiff = no\n# appending .domain is the MUA's job.\nappend_dot_mydomain = no\nreadme_directory = no\n\n# SASL parameters\n# ---------------------------------\n\n# Use Dovecot to authenticate.\nsmtpd_sasl_type = dovecot\n# Referring to \/var\/spool\/postfix\/private\/auth\nsmtpd_sasl_path = private\/auth\nsmtpd_sasl_auth_enable = yes\nbroken_sasl_auth_clients = yes\nsmtpd_sasl_security_options = noanonymous\nsmtpd_sasl_local_domain = \nsmtpd_sasl_authenticated_header = yes\n\n# TLS parameters\n# ---------------------------------\n\n# Replace this with your SSL certificate path if you are using one.\nsmtpd_tls_cert_file=\/etc\/ssl\/certs\/ssl-cert-snakeoil.pem\nsmtpd_tls_key_file=\/etc\/ssl\/private\/ssl-cert-snakeoil.key\n# The snakeoil self-signed certificate has no need for a CA file. But\n# if you are using your own SSL certificate, then you probably have\n# a CA certificate bundle from your provider. The path to that goes\n# here.\n#smtpd_tls_CAfile=\/path\/to\/ca\/file\nsmtpd_use_tls=yes\nsmtp_tls_security_level = may\nsmtpd_tls_security_level = may\n#smtpd_tls_auth_only = no\nsmtp_tls_note_starttls_offer = yes\nsmtpd_tls_loglevel = 1\nsmtpd_tls_received_header = yes\nsmtpd_tls_session_cache_timeout = 3600s\ntls_random_source = dev:\/dev\/urandom\n#smtpd_tls_session_cache_database = btree:${data_directory}\/smtpd_scache\n#smtp_tls_session_cache_database = btree:${data_directory}\/smtp_scache\n\n# See \/usr\/share\/doc\/postfix\/TLS_README.gz in the postfix-doc package for\n# information on enabling SSL in the smtp client.\n\n# SMTPD parameters\n# ---------------------------------\n\n# Uncomment the next line to generate \"delayed mail\" warnings\n#delay_warning_time = 4h\n# will it be a permanent error or temporary\nunknown_local_recipient_reject_code = 450\n# how long to keep message on queue before return as failed.\n# some have 3 days, I have 16 days as I am backup server for some people\n# whom go on holiday with their server switched off.\nmaximal_queue_lifetime = 7d\n# max and min time in seconds between retries if connection failed\nminimal_backoff_time = 1000s\nmaximal_backoff_time = 8000s\n# how long to wait when servers connect before receiving rest of data\nsmtp_helo_timeout = 60s\n# how many address can be used in one message.\n# effective stopper to mass spammers, accidental copy in whole address list\n# but may restrict intentional mail shots.\nsmtpd_recipient_limit = 16\n# how many error before back off.\nsmtpd_soft_error_limit = 3\n# how many max errors before blocking it.\nsmtpd_hard_error_limit = 12\n\n# This next set are important for determining who can send mail and relay mail\n# to other servers. It is very important to get this right - accidentally producing\n# an open relay that allows unauthenticated sending of mail is a Very Bad Thing.\n#\n# You are encouraged to read up on what exactly each of these options accomplish.\n\n# Requirements for the HELO statement\nsmtpd_helo_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_hostname, reject_invalid_hostname, permit\n# Requirements for the sender details\nsmtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, warn_if_reject reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining, permit\n# Requirements for the connecting server\nsmtpd_client_restrictions = reject_rbl_client sbl.spamhaus.org, reject_rbl_client blackholes.easynet.nl, reject_rbl_client dnsbl.njabl.org\n# Requirement for the recipient address. Note that the entry for\n# \"check_policy_service inet:127.0.0.1:10023\" enables Postgrey.\nsmtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, check_policy_service inet:[::1]:10023, permit\nsmtpd_data_restrictions = reject_unauth_pipelining\n\n# require proper helo at connections\nsmtpd_helo_required = yes\n# waste spammers time before rejecting them\nsmtpd_delay_reject = yes\ndisable_vrfy_command = yes\n\n# General host and delivery info\n# ----------------------------------\n\nmyhostname = panama-verlag.de\nmyorigin = \/etc\/hostname\n# Some people see issues when setting mydestination explicitly to the server\n# subdomain, while leaving it empty generally doesn't hurt. So it is left empty here.\n# mydestination = mail.example.com, localhost\nmydestination = panama-verlag.de\n# If you have a separate web server that sends outgoing mail through this\n# mailserver, you may want to add its IP address to the space-delimited list in\n# mynetworks, e.g. as 111.222.333.444\/32.\nmynetworks = 127.0.0.0\/8 [::ffff:127.0.0.0]\/104 [::1]\/128\nmailbox_size_limit = 0\nrecipient_delimiter = +\ninet_interfaces = all\nmynetworks_style = host\n\n# This specifies where the virtual mailbox folders will be located.\nvirtual_mailbox_base = \/var\/vmail\n# This is for the mailbox location for each user. The domainaliases\n# map allows us to make use of Postfix Admin's domain alias feature.\nvirtual_mailbox_maps = mysql:\/etc\/postfix\/mysql_virtual_mailbox_maps.cf, mysql:\/etc\/postfix\/mysql_virtual_mailbox_domainaliases_maps.cf\n# and their user id\nvirtual_uid_maps = static:150\n# and group id\nvirtual_gid_maps = static:8\n# This is for aliases. The domainaliases map allows us to make\n# use of Postfix Admin's domain alias feature.\nvirtual_alias_maps = mysql:\/etc\/postfix\/mysql_virtual_alias_maps.cf, mysql:\/etc\/postfix\/mysql_virtual_alias_domainaliases_maps.cf\n# This is for domain lookups.\nvirtual_mailbox_domains = mysql:\/etc\/postfix\/mysql_virtual_domains_maps.cf\n\n# Integration with other packages\n# ---------------------------------------\n\n# Tell postfix to hand off mail to the definition for dovecot in master.cf\nvirtual_transport = dovecot\ndovecot_destination_recipient_limit = 1\n\n# Use amavis for virus and spam scanning\ncontent_filter = amavis:[127.0.0.1]:10024\n\n# Header manipulation\n# --------------------------------------\n\n# Getting rid of unwanted headers. See: https:\/\/posluns.com\/guides\/header-removal\/\nheader_checks = regexp:\/etc\/postfix\/header_checks\n# getting rid of x-original-to\nenable_original_recipient = no\n<\/code><\/pre>\n<p>if I check the mysql query with <code>postmap -q test@mydomain.com mysql:\/etc\/postfix\/mysql_virtual_mailbox_maps.cf<\/code> than it&#8217;s returning the user like<\/p>\n<pre><code> mydomain.com\/test\n<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-11-28 10:12:29. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I have been setting up an email server based on this tutorial on ubuntu 12.04 with MySQL virtualuser. After having problems with postgray I&#8217;m again in that situation that I don&#8217;t know where should I search to debug my problem properly. Sending email from my servers mailbox to another account is working, for example Gmail. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1693","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1693","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1693"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1693\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}