我正在做一个项目,我需要创建一个 SMTP 服务器来发送和接收电子邮件。我已经使用 postfix 在 ubuntu 上配置了一个服务器。它工作得很好。我可以发送电子邮件,也可以接收电子邮件。但问题是,当我尝试一次发送多封电子邮件(从 java 代码发送电子邮件)时,只有 1-2 封电子邮件发送,其余邮件进入邮件队列。我在日志文件中得到的响应如下
mailto postfix/qmgr[24883]: 768DE26068: from=<ankit@myserver.com>, size=440, nrcpt=1 (queue active)
Sep 29 09:18:02 mailto postfix/smtpd[24956]: disconnect from unknown[220.227.69.18]
Sep 29 09:18:28 mailto postfix/smtp[24963]: connect to ASPMX.L.GOOGLE.com[74.125.129.26]:25: Connection timed out
我不知道为什么邮件要排队?我用google搜索了这个问题,发现这个问题是由于ipv6配置造成的。但是我的配置是ipv4。这应该有效。
请调查一下。并建议我一些有用的解决方案。
更新
我的 postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
home_mailbox = Maildir/
html_directory = /usr/share/doc/postfix/html
inet_interfaces = all
inet_protocols = ipv4
mailbox_command =
mailbox_size_limit = 0
mydestination = myserver.com, localhost.localdomain, localhost
myhostname = mailto.myserver.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 54.191.22.0/24
myorigin = /etc/mailname
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix
recipient_delimiter = +
relayhost =
smtp_tls_note_starttls_offer = yes
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks, reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_cert_file = /etc/ssl/certs/server.crt
smtpd_tls_key_file = /etc/ssl/private/server.key
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
transport_maps = hash:/etc/postfix/transport
virtual_alias_maps = hash:/etc/postfix/virtual_aliases