![Roundcube 发送没有主题的电子邮件](https://linux22.com/image/652970/Roundcube%20%E5%8F%91%E9%80%81%E6%B2%A1%E6%9C%89%E4%B8%BB%E9%A2%98%E7%9A%84%E7%94%B5%E5%AD%90%E9%82%AE%E4%BB%B6.png)
我最近设置了一个由postfix
和组成的邮件服务器dovecot
。昨天我添加了nginx
和roundcube
。SPF、DKIM、DMARC、rDNS 记录都已完成。Gmail 将我的邮件视为有效邮件并将其发送到我的收件箱。一切正常。除了一件烦人的小事。
当我使用 Android 内置的 MUA 或其他 MUA 时,一切仍然正常。当我想使用 roundcube 发送邮件时,问题就开始了。邮件仍然经过验证并正确投递,但没有主题。不知何故,roundcube 丢失了主题字段并发送了没有主题的电子邮件。
我已经连续 7 个小时寻找答案,但似乎我是世界上唯一遇到此问题的人。这让我认为我的服务器或配置出了问题,但我仔细检查了所有配置,但仍然一无所知。
任何帮助都将非常有用。提前感谢您的时间。
我的邮件服务器位于具有 768MB RAM 的 OpenVZ 盒上,运行 CentOS 7 Minimal。Postfix 版本:2.10.1 Dovecot 版本:2.2.10 Roundcube 版本:1.1.0
我的postconf -n
输出:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
disable_vrfy_command = yes
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = localhost
myhostname = mail.example.com
newaliases_path = /usr/bin/newaliases.postfix
non_smtpd_milters = unix:/var/run/opendkim/opendkim.sock
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_delay_reject = no
smtpd_helo_required = yes
smtpd_helo_restrictions = reject_unknown_helo_hostname, reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname
smtpd_milters = unix:/var/run/opendkim/opendkim.sock
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_sender_restrictions = reject_unknown_sender_domain
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/pki/dovecot/certs/dovecot.pem
smtpd_tls_key_file = /etc/pki/dovecot/private/dovecot.pem
smtpd_use_tls = yes
strict_rfc821_envelopes = yes
unknown_local_recipient_reject_code = 550
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
我的 Roundcube 配置摘录如下config/config.inc.php
:
$config['debug_level'] = 5;
$config['db_dsnw'] = 'mysql://user:pass@localhost/database';
$config['default_host'] = 'tls://localhost';
$config['default_port'] = 993;
$config['smtp_server'] = 'tls://localhost';
$config['smtp_port'] = 587;
$config['ip_check'] = true;
$config['identities_level'] = 3;
$config['des_key'] = 'some key';
$config['mime_types'] = '/usr/share/nginx/html/roundcube/mime.types';
$config['preview_pane'] = true;
答案1
我找到了我自己的问题的答案。
以下是 program/steps/mail/sendmail.inc 中的第 507-513 行。
// encoding subject header with mb_encode provides better results with asian characters
if (function_exists('mb_encode_mimeheader')) {
mb_internal_encoding($message_charset);
$headers['Subject'] = mb_encode_mimeheader($headers['Subject'],
$message_charset, 'Q', "\r\n", 8);
mb_internal_encoding(RCUBE_CHARSET);
}
这是提到变量的两个地方之一$headers['Subject']
。另一个是设置变量的第 196 行。
由于我和我的客户都与亚洲字符无关,我决定注释掉这段代码块,看看会发生什么,然后瞧!主题开始工作了。看来 roundcube 有一个奇怪的错误。我希望这有一天能对某人有所帮助。