Email

Roundcube 發送沒有主題的電子郵件

  • February 28, 2015

我最近設置了一個郵件伺服器,其中包含postfixdovecot。昨天我添加了nginxroundcube混合。SPF、DKIM、DMARC、rDNS 記錄全部完成。Gmail 將我的郵件視為有效郵件並將其發送到我的收件箱。一切正常。除了一件煩人的小事。

當我使用 Android 的內置 MUA 或其他 MUA 時,一切都很好。當我想使用圓形立方體發送郵件時,問題就開始了。郵件仍然經過驗證並正確發送,但沒有主題。不知何故,roundcube 正在失去主題欄位並在沒有主題的情況下發送我的電子郵件。

我連續 7 個小時一直在尋找答案,但似乎我是世界上唯一遇到此問題的人。這讓我覺得我的伺服器或配置有問題,但我四次檢查了我的所有配置,但我仍然一無所知。

任何幫助都將非常有用。在此先感謝您的時間。

我的郵件伺服器在一個具有 768MB RAM 的 OpenVZ 機器上,執行 CentOS 7 Minimal。後綴版本: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;

我找到了解決我自己問題的方法。

以下是 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 行。

由於我和我的客戶都與亞洲字元無關,因此我決定將這段程式碼塊註釋掉,看看會發生什麼,瞧!受試者開始工作。似乎圓形立方體有一個奇怪的錯誤。我希望有一天這會對某人有所幫助。

引用自:https://serverfault.com/questions/671817