这是我的问题。
我有一个Java Web应用程序,应该发送一些邮件通知用于各种目的。为此,我添加了apache的commons-email artifact。
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.4</version>
</dependency>
另一方面,它部署在Ubuntu 16.04上,其中有一个后缀安装。这是main.cf.我已经清理了三个单词,替换为泛型,这些是:
但在我的配置文件中每个也只有一个字,没什么奇怪的。
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=/path/to/certs/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/path/to/certs/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 = servername.members.linode.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = servername.domain.com, localhost, localhost.localdomain, localhost, project.domain.com
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
最后我的问题:我如何配置这个后缀安装,以便我的Java代码不需要身份验证,或者如果它(甚至更好),我在哪里/如何设置它?
我的方向错了吗?提前谢谢!
答案 0 :(得分:1)
您需要将Java Web应用程序的IP地址添加到mynetworks参数:
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
然后发出
postfix reload
触发的第一个限制是&#34; permit_mynetworks&#34;邮件将被通过!