Merge pull request #136 from ONLYOFFICE/bugfix/mail-external-resolves

Fix Bug 54911/Correction of resolving the external address of the machine
This commit is contained in:
Alexey Golubev 2022-01-21 18:43:13 +03:00 committed by GitHub
commit e5d247644f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -805,6 +805,9 @@ if [ "${MAIL_SERVER_ENABLED}" == "true" ]; then
if check_ip_is_internal $DOCKER_APP_SUBNET $MAIL_SERVER_API_HOST; then
SENDER_IP=$(hostname -i);
if [[ -n ${MAIL_DOMAIN_NAME} ]]; then
echo "$(dig +short myip.opendns.com @resolver1.opendns.com) ${MAIL_DOMAIN_NAME}" >> /etc/hosts
fi
elif [[ "$(dig +short myip.opendns.com @resolver1.opendns.com)" =~ $VALID_IP_ADDRESS_REGEX ]]; then
SENDER_IP=$(dig +short myip.opendns.com @resolver1.opendns.com);
log_debug "External ip $SENDER_IP is valid";