我有服务器,我想build立一个邮件服务器,让我接收和发送来自我的域名的电子邮件。 我目前有一个问题,虽然我不能收到邮件。 发送电子邮件是完美的。
我将使用这个脚本,其中显示了如何使用Postfix,Dovecotconfiguration邮件服务器,并使用Postgresql作为后端( https://gist.github.com/solusipse/7ed8e1da104baaee3f05 )。
/etc/postfix/main.cf文件:
relay_domains = virtual_alias_maps = proxy:pgsql:/etc/postfix/virtual_alias_maps.cf virtual_mailbox_domains = proxy:pgsql:/etc/postfix/virtual_mailbox_domains.cf virtual_mailbox_maps = proxy:pgsql:/etc/postfix/virtual_mailbox_maps.cf virtual_mailbox_base = /home/vmail virtual_mailbox_limit = 512000000 virtual_minimum_uid = 5000 virtual_transport = virtual virtual_uid_maps = static:5000 virtual_gid_maps = static:5000 local_transport = virtual local_recipient_maps = transport_maps = hash:/etc/postfix/transport smtpd_sasl_auth_enable = yes smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination smtpd_sasl_security_options = noanonymous smtpd_sasl_tls_security_options = smtpd_tls_auth_only = yes smtpd_tls_cert_file = /etc/ssl/private/server.crt smtpd_tls_key_file = /etc/ssl/private/server.key smtpd_sasl_local_domain = broken_sasl_auth_clients = yes smtpd_tls_loglevel = 1 html_directory = /usr/share/doc/postfix/html queue_directory = /var/spool/postfix mydestination = localhost
/etc/dovecot/dovecot.conf:
protocols = imap auth_mechanisms = plain passdb { driver = sql args = /etc/dovecot/dovecot-sql.conf } userdb { driver = sql args = /etc/dovecot/dovecot-sql.conf } service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0660 user = postfix } user = root } mail_home = /home/vmail/%d/%u mail_location = maildir:~ ssl_cert = </etc/ssl/private/server.crt ssl_key = </etc/ssl/private/server.key
/var/logs/mail.log:
Apr 17 19:46:18 v22015072919626549 postfix/smtpd[8837]: connect from *** Apr 17 19:46:18 v22015072919626549 postfix/smtpd[8837]: 62D6A3E0DC9: client=*** Apr 17 19:46:18 v22015072919626549 postfix/cleanup[8843]: 62D6A3E0DC9: message-id=*** Apr 17 19:46:18 v22015072919626549 postfix/smtpd[8837]: disconnect from *** Apr 17 19:46:18 v22015072919626549 postfix/qmgr[9001]: 62D6A3E0DC9: from=<***>, size=1160, nrcpt=1 (queue active) Apr 17 19:46:18 v22015072919626549 postfix/virtual[8844]: 62D6A3E0DC9: to=<***>, relay=virtual, delay=0.05, delays=0.01/0.01/0/0.02, dsn=2.0.0, status=sent (delivered to maildir) Apr 17 19:46:18 v22015072919626549 postfix/qmgr[9001]: 62D6A3E0DC9: removed
Apr17 19:46:18 v22015072919626549 postfix / virtual [8844]:62D6A3E0DC9:to = ***,relay = virtual,delay = 0.05,delay = 0.01 / 0.01 / 0 / 0.02,dsn = 2.0.0,status =发送( 交付给maildir )
所以Postfix将邮件发送到某个地方 ,但我们还不知道在哪里 。
我不能收到邮件。 发送电子邮件是完美的。
那么你确定Postfix 在Dovecot正在寻找邮件吗?
电子邮件确实存储在某个地方; 日志摘录明白这么说。 根据Postfix网站上的手册页, 虚拟(8)将邮箱path名构build为$virtual_mailbox_base/$virtual_mailbox_maps(recipient) ,其中收件人是完整的收件人地址。 virtual_mailbox_base来自postfix.cf ,在你的configuration中设置为/home/vmail ,你的virtual_mailbox_maps设置看起来也合理有效(如果问题出在这里,你可能会看到Postfix在抱怨)。
这是通过Dovecot的configurationmail_home = /home/vmail/%d/%u来镜像的。 但是在Dovecot中,你也正在设置mail_location = maildir:~ 。
基于Dovecot Wiki上的VirtualUsers / Home和MailLocation ,它看起来像这意味着Dovecot直接在/ home / vmail / something / something下寻找“qmail-style”(也称为Maildir) cur , new和tmp 。 这是你的Postfix虚拟邮箱地图configuration为传递收件人的电子邮件?
你应该仔细检查两个configuration是否同步。 我猜测他们不是,而且这导致了两个软件 – 这些软件真的没有任何关系 – 与不同的maildir位置一起工作。 这就可以解释为什么双方都声称一切都很好,但是他们看到了对现实的不同看法。
有可能打开dont_remove可能会帮助您诊断此问题,通过使Postfix在最终交付完成后将邮件假脱机文件保留在磁盘上。 (邮件后台处理文件通常在成功交付后被删除。)
你有没有尝试从另一个盒子端口25直接telnet到您的服务器? 其中最常见的错误是让iptables阻塞传入的tcp/25 。 如果这被拒绝,你只需要允许通过iptables传入tcp/25 。