1

Topic: intermittent connection problems when sending via server

hello all

i have recently migrated to an iredmail setup and things are really working well.   my setup details
iredmail version 0.1.7
backend: ldap

i have this mailserver installed on a separate server to my website:
Linux 3.4.2-x86
centos 6.3

the resaon why i am try to solve this problem here is that i did not have this error when my old mailserver was operating before migrating to iredmail.

only sometimes when i attempt to connect to the mailserver via smtp (using PHPMailer 5.2) via my website, i get the following error:

SMTP -> ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Name or service not known (0)
SMTP Error: Could not connect to SMTP host.

phpmailer connects via @fsockopen($host,$port, $errno, $errstr, $tval); i have attempted to connect via ports 25 and 487 with the same results for both

i thought with my tinkering from my endless searches that i may have solved the problem, but it has appeared again so i am hoping that someone might have a clue.

the thing is that when i run one particuular script which involves sending 2 emails to the same person  (with different info in each - no the info cannot be put together into one!) the first email sends just fine, but the second one has the error above.

the mail log tells me nothing because it is not even connecting, although here is the log of the first message that succeeds

Aug  5 06:19:38 mailer postfix/smtpd[22304]: connect from unknown[xxx.xxx.xxx.xxx]
Aug  5 06:19:38 mailer postfix/smtpd[22304]: 4D002796F: client=unknown[xxx.xxx.xxx.xxx], sasl_method=LOGIN, sasl_username=mailer@mymaildomain.com
Aug  5 06:19:38 mailer postfix/cleanup[22308]: 4D002796F: message-id=<80e8253279667d0cbfe6e75187989a75@www.websitedomain.com>
Aug  5 06:19:38 mailer postfix/qmgr[25825]: 4D002796F: from=<info@websitedomain.com>, size=1052, nrcpt=1 (queue active)
Aug  5 06:19:38 mailer postfix/smtpd[22304]: lost connection after RSET from unknown[xxx.xxx.xxx.xxx]
Aug  5 06:19:38 mailer postfix/smtpd[22304]: disconnect from unknown[173.255.205.216]
Aug  5 06:19:38 mailer postfix/smtpd[22312]: connect from mailer.mymaildomain.com[127.0.0.1]
Aug  5 06:19:38 mailer postfix/smtpd[22312]: D49D97970: client=mailer.mymaildomain.com[127.0.0.1]
Aug  5 06:19:38 mailer postfix/cleanup[22308]: D49D97970: message-id=<80e8253279667d0cbfe6e75187989a75@www.websitedomain.com>
Aug  5 06:19:38 mailer postfix/smtpd[22312]: disconnect from mailer.mymaildomain.com[127.0.0.1]
Aug  5 06:19:38 mailer postfix/qmgr[25825]: D49D97970: from=<info@websitedomain.com>, size=1535, nrcpt=1 (queue active)
Aug  5 06:19:38 mailer amavis[20959]: (20959-15) Passed CLEAN, MYUSERS LOCAL [xxx.xxx.xxx.xxx] [xxx.xxx.xxx.xxx] <info@websitedomain.com> -> <raymond@anotherdomain.info>, Message-ID: <80e8253279667d0cbfe6e75187989a75@www.websitedomain.com>, mail_id: 1ZTp06VWtJTm, Hits: -11.9, size: 1051, queued_as: D49D97970, 528 ms
Aug  5 06:19:38 mailer postfix/smtp[22309]: 4D002796F: to=<raymond@anotherdomain.info>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.59, delays=0.05/0/0/0.54, dsn=2.0.0, status=sent (250 2.0.0 from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as D49D97970)
Aug  5 06:19:38 mailer postfix/qmgr[25825]: 4D002796F: removed

here is my postfix config

alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
allow_min_user = no
biff = no
bounce_queue_lifetime = 1d
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
content_filter = smtp-amavis:[127.0.0.1]:10024
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
delay_warning_time = 0h
disable_vrfy_command = yes
enable_original_recipient = no
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
inet_protocols = ipv4
mail_owner = postfix
mailbox_command = /usr/libexec/dovecot/deliver
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
maximal_backoff_time = 4000s
maximal_queue_lifetime = 1d
message_size_limit = 15728640
minimal_backoff_time = 300s
mydestination = $myhostname, localhost, localhost.localdomain, localhost.$myhostname
mydomain = mymaildomain.com
myhostname = mailer.mymaildomain.com
mynetworks = 127.0.0.0/8
mynetworks_style = subnet
myorigin = mailer.mymaildomain.com
newaliases_path = /usr/bin/newaliases.postfix
proxy_read_maps = $canonical_maps $lmtp_generic_maps $local_recipient_maps $mydestination $mynetworks $recipient_bcc_maps $recipient_canonical_maps $relay_domains $relay_recipient_maps $relocated_maps $sender_bcc_maps $sender_canonical_maps $smtp_generic_maps $smtpd_sender_login_maps $transport_maps $virtual_alias_domains $virtual_alias_maps $virtual_mailbox_domains $virtual_mailbox_maps $smtpd_sender_restrictions
queue_directory = /var/spool/postfix
queue_run_delay = 300s
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
recipient_bcc_maps = proxy:ldap:/etc/postfix/ldap/recipient_bcc_maps_domain.cf, proxy:ldap:/etc/postfix/ldap/recipient_bcc_maps_user.cf
recipient_delimiter = +
relay_domains = $mydestination, proxy:ldap:/etc/postfix/ldap/relay_domains.cf
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sender_bcc_maps = proxy:ldap:/etc/postfix/ldap/sender_bcc_maps_domain.cf, proxy:ldap:/etc/postfix/ldap/sender_bcc_maps_user.cf
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_data_init_timeout = 240s
smtp_data_xfer_timeout = 600s
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_enforce_tls = no
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks,permit_sasl_authenticated, check_helo_access pcre:/etc/postfix/helo_access.pcre
smtpd_recipient_restrictions = reject_unknown_sender_domain, permit_sasl_authenticated, reject_unknown_recipient_domain, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unlisted_recipient, check_policy_service inet:127.0.0.1:7777, permit_mynetworks, reject_unauth_destination, reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname, check_policy_service inet:127.0.0.1:10031
smtpd_reject_unlisted_recipient = yes
smtpd_reject_unlisted_sender = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = no
smtpd_sasl_local_domain =
smtpd_sasl_path = ./dovecot-auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_login_maps = proxy:ldap:/etc/postfix/ldap/sender_login_maps.cf
smtpd_sender_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unknown_sender_domain, reject_unlisted_sender
smtpd_tls_CAfile = /etc/pki/tls/certs/ca_bundle_domain.com.pem
smtpd_tls_cert_file = /etc/pki/tls/certs/domain.com.crt
smtpd_tls_key_file = /etc/pki/tls/certs/domain.com.key
smtpd_tls_loglevel = 0
smtpd_tls_security_level = may
tls_random_source = dev:/dev/urandom
transport_maps = proxy:ldap:/etc/postfix/ldap/transport_maps_user.cf, proxy:ldap:/etc/postfix/ldap/transport_maps_domain.cf
unknown_local_recipient_reject_code = 550
virtual_alias_domains =
virtual_alias_maps = proxy:ldap:/etc/postfix/ldap/virtual_alias_maps.cf, proxy:ldap:/etc/postfix/ldap/virtual_group_maps.cf, proxy:ldap:/etc/postfix/ldap/sender_login_maps.cf, proxy:ldap:/etc/postfix/ldap/catchall_maps.cf
virtual_gid_maps = static:500
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = proxy:ldap:/etc/postfix/ldap/virtual_mailbox_domains.cf
virtual_mailbox_maps = proxy:ldap:/etc/postfix/ldap/virtual_mailbox_maps.cf
virtual_minimum_uid = 500
virtual_transport = dovecot
virtual_uid_maps = static:500

as i have previously said, it appears to work perfectly one minute then the dreaded error appears another.

i have tested at dozens, perhaps hundreds of times to try to see if certain patterns emerge, but none has jumped out at me.

i am now officially desparate!

hoping that someone might provide even a hint of what the hell is going on.

raymond s

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: intermittent connection problems when sending via server

quick Update

I have not found a solution to this problem, but i am sure the issue is around the fsockopen() function and how it reacts with the mail server.

but don't despair, i have found a workaround: i now make one connection and send multipe emails  using the one connection. the system is set up to send small numbers of emails at regular intervals and it seems to be owrking ok with the new coding.

if anyone does have a possible reason for the behaviour above, i would be interested to know

cheers

rs

ps overall, i am extremely happy with the iredmail setup