Skip to content
Snippets Groups Projects
Commit aedd4a56 authored by Bob Mottram's avatar Bob Mottram
Browse files

Resolve domain alias

parent d631d79e
No related branches found
No related tags found
No related merge requests found
......@@ -1042,6 +1042,35 @@ function email_smtp_proxy_through_isp {
if [ ! "$isp_smtp_password" ]; then
return
fi
temp_proxy_file=/tmp/emailproxy.txt
host "$isp_smtp_domain" > $temp_proxy_file
if [ -f $temp_proxy_file ]; then
temp_proxy_file_lines=$(wc -l < "$temp_proxy_file")
# shellcheck disable=SC2086
if [ $temp_proxy_file_lines -ge 2 ]; then
alias_str=$'alias'
if grep -q "$alias_str" $temp_proxy_file; then
# shellcheck disable=SC2002
line_str=$(cat "$temp_proxy_file" | awk 'NF>1{print $NF}' | grep "$alias_str")
if [ ${#line_str} -gt 4 ]; then
#shellcheck disable=SC2116
last_char=$(echo "${line_str:$i:1}")
if [[ "$last_char" == '.' ]]; then
# remove the last character
#shellcheck disable=SC2116
line_str2=$(echo ${line_str::-1})
line_str="$line_str2"
fi
if [[ "$line_str" == *'.'* ]]; then
isp_smtp_domain="$line_str"
fi
fi
fi
fi
rm $temp_proxy_file
fi
{ echo '# password file used when the local exim is authenticating to a remote';
echo '# host as a client.';
echo '#';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment