像许多升级到 Rails 2.2 的人一样,我在发送电子邮件时遇到了异常。此版本的 Rails 或更高版本确实需要使用 tls 来发送电子邮件。生产日志文件中的消息说:
hostname was not match with the server certificate
我对此进行了大量研究和工作,并尽我所能。我将切片的主机名更改为 ohlalaweb.com。如果我在 CL 上运行命令“主机名”,我会得到:
ohlalaweb.com
后缀似乎工作正常。我可以毫无问题地从 CL 向我的 gmail、yahoo 和 google 应用程序 gmail 帐户发送电子邮件。这是 cat /etc/postfix/main.cf 的结果
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
myorigin = /etc/mailname
smmtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ohlalaweb.pem
smtpd_tls_key_file=/etc/ssl/certs/ohlalaweb.pem
smtpd_use_tls=yes
# SA created next line to force postfix to use self create certificate
smtpd_tls_auth_only=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = ohlalaweb.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
我已经使用 ohlalaweb.com 主机名重新生成了 ssl 密钥。
有什么想法或建议吗?