linux postfix配置和主机名FQDN

我正在尝试使用https://library.linode.com/email/postfix/postfix2.9.6-dovecot2.0.19-mysql#sph_prerequisites中的教程设置带有postfix和dovecot的邮件服务器

我按照每个步骤操作并打开了防火墙中的每个邮件端口,但是当我尝试设置我的电子邮件客户端以连接IMAP或POP3时,它无法建立连接.

我似乎可以使用我的私人电子邮箱向我的域发送电子邮件.无论如何,我的日志/var/log/mail.log是空的.

我想这与设置主机名(FQDN)和后缀配置有关.但我对主机名和FQDN有点困惑.
在我的linode的DNS管理器中,我添加了我的域名,在这个例子中是:mydomain.com

在mydomain.com里面我有这个:

MX record 
mail.mydomain.com

A/AAAA Records
           120.120.120.120
www        120.120.120.120
mail       120.120.120.120
donald     120.120.120.120

donald是FQDN,因为我按照教程进行了操作

现在在我的linux服务器上我有一些东西:

/etc/hosts
127.0.0.1       localhost
127.0.1.1       ubuntu
120.120.120.120 donald.mydomain.com        donald

/etc/mailname
donald.mydomain.com

后缀配置

/etc/postfix/main.cf
....
myhostname = mail.mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = 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
....

如你所见,我认为在这个配置中出现问题.我不明白什么是myhostname和mydestination以及mailname …有人可以用theses配置纠正我吗?

谢谢!

编辑
我发现我在dovecot主配置中有一个错误,而且还有已经在使用的smtp端口..好吧,我重启了我的服务器,后缀和dovecot都在运行.我可以将imap服务器绑定到我的Outlook客户端并接收邮件.现在,当我尝试回复电子邮件时,我收到此消息:554 5.7.1:拒绝中继访问

这里也是我的postfix配置:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
mailbox_size_limit = 0
mydestination = localhost
myhostname = mail.mydomain.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/certs/dovecot.pem
smtpd_tls_key_file = /etc/ssl/private/dovecot.pem
smtpd_use_tls = yes
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

解决方法:

请参阅postfix configuration parameters获取更多帮助.

myorigin = mydomain.com 
# The domain name to append when the UNIX user sends out a mail. (For eg. If UNIX user john sends mail, then john@mydomain.com will be the sender address
myhostname = mail.mydomain.com
# The unique FQDN of your mail server. When talking to other SMTP servers, it identifies itself as mail.mydomain.com
mydestination = mydomain.com mail.mydomain.com
# You are instructing postfix to receive mails for the domains mydomain.com mail.mydomain.com, whose valid recipients can be specified using local_recipient_maps

你能编辑你的问题并粘贴postconf -n的输出,这将有助于识别问题

上一篇:具有多个运行接口的计算机上的Linux主机名解析


下一篇:3种方法更改Linux系统的主机名(hostname)