如何配置 postfix starttls

如何配置 postfix starttls

我需要在我的网络服务器上安装 postfix,因为我需要为我的网站使用 sendmail。我只需要发送邮件,不需要接收或中继。

通过中继 smtp.strato.de 使用 starttls(端口 587)发送

以下是发生的事情

Jul 15 00:02:38 negrita postfix/smtp[7120]: Host offered STARTTLS: [smtp.strato.de]
Jul 15 00:02:38 negrita postfix/smtp[7120]: C717A181252: to=<[email protected]>, relay=smtp.strato.de[81.169.145.133]:587, delay=0.31, delays=0.09/0/0.16/0.04, dsn=5.7.0, status=bounced (host smtp.strato.de[81.169.145.133] said: 530 5.7.0 Bitte konfigurieren Sie ihr E-Mailprogramm fuer Authentifizierung am SMTP Server, wie auf www.strato.de/email-hilfe beschrieben. - Please configure your mail client for using SMTP Server Authentication (in reply to MAIL FROM command))
Jul 15 00:02:38 negrita postfix/cleanup[7118]: 29F5F181254: message-id=<20120714220238.29F5F181254@negrita>
Jul 15 00:02:38 negrita postfix/qmgr[7102]: 29F5F181254: from=<>, size=2548, nrcpt=1 (queue active)
Jul 15 00:02:38 negrita postfix/bounce[7121]: C717A181252: sender non-delivery notification: 29F5F181254
Jul 15 00:02:38 negrita postfix/qmgr[7102]: C717A181252: removed
Jul 15 00:02:39 negrita postfix/local[7122]: 29F5F181254: to=<michael@negrita>, relay=local, delay=1.1, delays=0.04/0/0/1.1, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Jul 15 00:02:39 negrita postfix/qmgr[7102]: 29F5F181254: removed
Jul 15 08:05:18 negrita postfix/master[1083]: daemon started -- version 2.9.1, configuration /etc/postfix
Jul 15 08:05:29 negrita postfix/master[1083]: reload -- version 2.9.1, configuration /etc/postfix

和我的配置

michael@negrita:~$ postconf -n
biff = no
config_directory = /etc/postfix
delay_warning_time = 4h
home_mailbox = /home/michael/Maildir/
html_directory = /usr/share/doc/postfix/html
inet_interfaces = localhost
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
mydomain = example.com
myhostname = negrita
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
notify_classes = resource, software, protocol
readme_directory = /usr/share/doc/postfix
recipient_delimiter = +
relayhost = [smtp.strato.de]:587
smtp_sasl_password_maps = hash:/etc/postfix/sasl/passwd
smtp_tls_enforce_peername = no
smtp_tls_note_starttls_offer = yes
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
soft_bounce = yes

用户和密码正确,我可以用我的 Thunderbird 发送邮件

提前谢谢迈克

答案1

您的错误与身份验证有关,而不是 startTLS。

为什么你需要通过 smtp.strato.de 转发邮件?配置邮件转发的身份验证很困难(嗯,对于一份好文件),你可能不需要它。只需从你的 main.cf 中删除以下行(或类似行):

relayhost = [smtp.strato.de]:587

重新启动 postfix 就可以了

答案2

为了正确发送和接收您域名的电子邮件,您需要拥有DNS MX 记录. 该记录验证域的电子邮件服务器。

如果没有该记录,发送电子邮件在大多数情况下都不会起作用,因为大多数服务器都会检查来自传入服务器的 MX 记录并拒绝接受没有有效记录的电子邮件(它们使用 DNS 条目检查传入服务器的 IP 地址)。

当然,您的域名也需要在您的 postfix 配置中正确设置,并且您应该确保只接受您域名的电子邮件(否则您可能是一个开放中继服务器)。

这两个事实极其重要,这样您的电子邮件服务器才会被其他电子邮件服务器接受并允许发送您的电子邮件。

此外,如果您是开放中继并通过服务器发送垃圾邮件,您可能会很快被列入黑名单,然后您的服务器将无法使用,无论如何。要再次将其从列表中删除将是一件困难的事情。所以一定要小心。

哦,顺便说一句……您尝试使用 strato 作为中继服务器,但无法正常工作。您只能以 strato 用户(帐户)的身份和有效密码发送电子邮件。

而且,如果您拥有一个 Strato 帐户和有效密码,则电子邮件将通过您的 Strato 帐户发送,而不是您自己的域帐户。

相关内容