D
D
Dmitry Morozov2017-04-04 17:45:24
linux
Dmitry Morozov, 2017-04-04 17:45:24

How to make sending emails via postfix fast?

There is a webserver, on it postfix. When sending a letter via PHP mail(), it takes about 15 minutes until the letter actually leaves. Tell me where to dig? The postfix config is:

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
myhostname = extmail.DOMAIN.com
mydomain = DOMAIN2.ru
myorigin = $myhostname
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, localhost
unknown_local_recipient_reject_code = 550

mynetworks_style = subnet

mynetworks = 127.0.0.0/8,89.21.77.88/32

relay_domains = mysql:/etc/postfix/mysql-virtual_relay_domains.cf

alias_maps = hash:/etc/aliases

alias_database = hash:/etc/aliases

smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)

debugger_command =
   PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
   ddd $daemon_directory/$process_name $process_id & sleep 5


sendmail_path = /usr/sbin/sendmail.postfix

newaliases_path = /usr/bin/newaliases.postfix

mailq_path = /usr/bin/mailq.postfix

setgid_group = postdrop

html_directory = no

manpage_directory = /usr/share/man

sample_directory = /usr/share/doc/postfix-2.6.6/samples

readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES

smtp_bind_address = 88.98.112.24

inet_protocols = ipv4
smtpd_recipient_restrictions =  permit_mynetworks,
                                permit_sasl_authenticated,
                                check_client_access hash:/etc/postfix/access-client,
                                check_sender_access hash:/etc/postfix/whitelist,
                                reject_unlisted_recipient,
                                reject_non_fqdn_sender,
                                reject_non_fqdn_recipient,
                                reject_unauth_destination,
                                reject_unauth_pipelining,
                                reject_invalid_hostname,
                                reject_unknown_sender_domain,
                                reject_unknown_recipient_domain,
                                reject_rbl_client cbl.abuseat.org,
                                reject_rbl_client relays.mail-abuse.org,
                                reject_rbl_client dnsbl.njabl.org,
                                reject_rbl_client combined.njabl.org,
                                reject_rbl_client bl.spamcop.net,
                                reject_rbl_client zen.spamhaus.org,
        permit

smtpd_client_restrictions = check_client_access hash:/etc/postfix/access-client,
                            permit_sasl_authenticated,
                            permit_mynetworks,
                            reject_unauth_destination,
                            reject_unknown_recipient_domain,
                            reject_invalid_hostname,
                            reject_non_fqdn_recipient
                            permit

# ограничения на приветствие отправителя HELO/EHLO
smtpd_helo_restrictions =   check_helo_access hash:/etc/postfix/helo_access,
                            permit_sasl_authenticated,
                            permit_mynetworks,
                            reject_non_fqdn_hostname,
                            reject_invalid_hostname,
                            reject_unknown_hostname,
                            permit



# ограничения, проверяемые на этапе MAIL FROM:
smtpd_sender_restrictions =
                            # принимаем почту на отправку с "чужих" хостов, если пользователь
                            # авторизовался по логину/паролю
                            permit_sasl_authenticated,
                            # "своим" можно и "просто"
                            permit_mynetworks,
                            # см комментарий к разделу smtpd_helo_restrictions
                            reject_non_fqdn_sender,
                            reject_unknown_sender_domain,
                            # если все вышеперечисленное подошло, идем дальше
                            permit

soft_bounce = no
myhostname = extmail.DOMAIN.com
mydomain = DOMAIN2.ru
myorigin = $myhostname
mydestination = localhost.$mydomain, localhost
alias_maps = hash:/etc/aliases
smtpd_banner = $myhostname ESMTP $mail_name

# ============================================================
# LIMITS
# ============================================================
message_size_limit = 51200000
smtpd_soft_error_limit = 10
smtpd_hard_error_limit = 15
smtpd_error_sleep_time = 20
anvil_rate_time_unit = 60s
smtpd_client_connection_count_limit = 20
smtpd_client_connection_rate_limit = 30
smtpd_client_message_rate_limit = 30
smtpd_client_event_limit_exceptions = 127.0.0.0/8
smtpd_client_connection_limit_exceptions = 127.0.0.0/8

# ============================================================
# QUEUE
# ============================================================
maximal_queue_lifetime = 1d
bounce_queue_lifetime = 1d


# ============================================================
# TLS
# ============================================================
smtp_tls_security_level = may
smtpd_tls_security_level = may
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtp_tls_session_cache_database = btree:$data_directory/smtp_tls_session_cache
smtpd_tls_key_file = /etc/postfix/certs/key.pem
smtpd_tls_cert_file = /etc/postfix/certs/cert.pem
tls_random_source = dev:/dev/urandom

# ============================================================
# SASL
# ============================================================
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_authenticated_header = yes
smtpd_helo_required = no

# ============================================================
# VIRTUAL
# ============================================================
virtual_mailbox_base = /var/vmail
virtual_minimum_uid = 1000
virtual_uid_maps = static:1000
virtual_gid_maps = static:1000
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

home_mailbox = Maildir/

virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_mailbox_domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual_mailbox_maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual_alias_maps.cf

content_filter=amavisfeed:[127.0.0.1]:10024

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
athacker, 2017-04-04
@athacker

An indiscreet question - have you tried reading the logs? :-) There after all all stages of passage of the letter on instances are reflected. Here you can see where it goes wrong.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question