大网数据广告活动
服务器运维问答

Setting up mailserver with relay host

· 52CE 我爱测

So the port 25 on my mailserver is blocked and I'm now trying to set up my mail server with a SMTP relay to send mail with dynu.com. But i keep getting the error messages bellow when i try to send a mail from the terminal window.…

问题原文

原帖链接 · Rajohan · CC BY-SA 3.0

So the port 25 on my mailserver is blocked and I'm now trying to set up my mail server with a SMTP relay to send mail with dynu.com. But i keep getting the error messages bellow when i try to send a mail from the terminal window.

In master.cf I have set the following

465 inet n - n - - smtpd

In main.cf I have set this

myhostname = rajohan.no
mydestination = localhost, rajohan.no, localhost.rajohan.no
mynetworks = 127.0.0.0/8 192.168.0.0/24 [::ffff:127.0.0.0]/104 [::1]/128

smtpd_sasl_auth_enable = yes
smtpd_sasl_password_maps = hash:/etc/postfix/sasl_password

relayhost = [relay.dynu.com]:465
smtpd_generic_maps = hash:/etc/postfix/generic

In sasl_password i have

relay.dynu.com
[email omitted] mypassword

In generic i have

[email omitted]         [email omitted]
[email omitted]      [email omitted]
[email omitted]    [email omitted]
[email omitted]   [email omitted]
[email omitted]         [email omitted]
[email omitted]    [email omitted]
[email omitted]        [email omitted]
[email omitted]   [email omitted]

Dec 19 22:22:49 rajohan dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=30452, secured, session=<6DQx6LhgdJZ/AAAB>

Dec 19 22:22:49 rajohan dovecot: imap([email omitted]): Logged out in=50 out=490

Dec 19 22:22:57 rajohan postfix/pickup[30405]: AEF3884669: uid=0 from=

Dec 19 22:22:57 rajohan postfix/cleanup[30461]: warning: connect to Milter service unix:/opendkim/opendkim.sock: No such file or directory

Dec 19 22:22:57 rajohan postfix/cleanup[30461]: AEF3884669: message-id=<[email omitted]>

Dec 19 22:22:57 rajohan postfix/qmgr[30406]: AEF3884669: from=, size=284, nrcpt=1 (queue active)

Dec 19 22:22:57 rajohan postfix/smtp[30467]: SMTPS wrappermode (TCP port 465) requires setting "smtp_tls_wrappermode = yes", and "smtp_tls_security_level = encrypt" (or stronger)

Dec 19 22:22:59 rajohan postfix/smtp[30467]: AEF3884669: to=[email omitted]>, relay=relay.dynu.com[199.233.237.19]:465, delay=23, delays=21/0.08/1.3/0.33, dsn=5.0.0, status=bounced (host relay.dynu.com[199.233.237.19] said: 530 SMTP authentication is required. (in reply to RCPT TO command))

Dec 19 22:22:59 rajohan postfix/cleanup[30461]: BFE7E84668: message-id=<[email omitted]>

Dec 19 22:22:59 rajohan postfix/qmgr[30406]: BFE7E84668: from=<>, size=2190, nrcpt=1 (queue active)

Dec 19 22:22:59 rajohan postfix/trivial-rewrite[30462]: warning: do not list domain rajohan.no in BOTH mydestination and virtual_mailbox_domains

Dec 19 22:22:59 rajohan postfix/bounce[30470]: AEF3884669: sender non-delivery notification: BFE7E84668

Dec 19 22:22:59 rajohan postfix/qmgr[30406]: AEF3884669: removed

Dec 19 22:22:59 rajohan postfix/local[30471]: BFE7E84668: to=, orig_to=, relay=local, delay=0.06, delays=0.03/0/0/0.03, dsn=5.1.1, status=bounced (unknown user: "webmaster")

Dec 19 22:22:59 rajohan postfix/qmgr[30406]: BFE7E84668: removed

已采纳解答

原帖链接 · Appleoddity · CC BY-SA 3.0

Your sasl_password file should be formatted like this and match that of the relayhost directive:

[host]:Port USERNAME:PASSWORD

So, your's would look like this:

[relay.dynu.com]:465 [email omitted]:mypassword

Then you need to hash the file: sudo postmap /etc/postfix/sasl_password

Now, you have a file created: /etc/postfix/sasl_password.db

Change the following directives in your main.cf (remove the d):

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password

Don't forget to restart postfix.

Configuring SASL authentication in the Postfix SMTP/LMTP client

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-12-19)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。