如何配置 myhostname 以与 Azure VM 上的 postfix 和 Ubuntu 14.04 配合使用

如何配置 myhostname 以与 Azure VM 上的 postfix 和 Ubuntu 14.04 配合使用

我的主机名文件如下所示。

virtual-machine-set

主机名 -f

virtual-machine-set

/etc/hosts 内容如下

127.0.0.1 localhost
191.xxx.xx.xx myazuredomain.cloudapp.net

#The following are name resolutions for INCRONTAB sync
[email protected]:22 virtual-machine-set
[email protected]:23 virtual-machine-set-2

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
127.0.0.1 virtual-machine-set # bitnami-hosts-patch

我的 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

smtpd_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/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=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.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated         defer_unauth_destination
myhostname = mydesireddomain.com
virtual_alias_maps = hash:/etc/postfix/virtual
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mydesireddomain.com, virtual-machine-set, 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

我的 /etc/mailname 是这样的

mydesireddomain.com

因此,我收到了以“ Ubuntu bitnami@virtual-machine-set ” 形式发送的邮件

我想要使​​用发送邮件的 myhostname 来反映我的域名,但它根本没有被使用。

我会注意,但我假设这不是问题,因为我还没有为 mydesireddomain.com dns 设置 MX 记录。不过我认为这与问题无关。

答案1

您的电子邮件将使用您在 hosts 文件中配置的内容(即 hostname 命令的结果)发送。这没什么问题。

相关内容