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

Remove html formatting from emails

parent bdda0da9
No related branches found
No related tags found
No related merge requests found
......@@ -1960,4 +1960,33 @@ function remove_ip_addresses_from_email_logs {
cron_add_mins 1 '/usr/bin/exim_log_tidy'
}
function email_remove_html {
html_remove_script='/usr/bin/remove_html.pl'
if [ ! -f "${html_remove_script}" ]; then
if $INSTALL_PACKAGES libhtml-strip-perl; then
{ echo '#!/usr/bin/perl';
echo 'use HTML::Strip;';
echo "my \$hs = HTML::Strip->new();";
echo "my \$clean_text = \$hs->parse( <STDIN> );";
echo "\$hs->eof;";
echo "print \$clean_text;"; } > "${html_remove_script}"
chmod +x "${html_remove_script}"
fi
fi
if [ -f "${html_remove_script}" ]; then
for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [ -f "/home/$USERNAME/.procmailrc" ]; then
if ! grep -q '# remove html begin' "/home/$USERNAME/.procmailrc"; then
{ echo '# remove html begin';
echo ':0 f';
echo "| ${html_remove_script}";
echo '# remove html end'; } >> "/home/$USERNAME/.procmailrc"
fi
fi
done
fi
}
# NOTE: deliberately no exit 0
......@@ -153,6 +153,7 @@ if [ -d "$PROJECT_DIR" ]; then
android_update_apps yes
populate_keyservers
disable_email_encryption_at_rest
email_remove_html
if [ -f /var/log/freedns_@_update.log ]; then
rm /var/log/freedns_@_update.log
fi
......
......@@ -1197,6 +1197,9 @@ function setup_email {
function_check import_email
import_email
function_check email_remove_html
email_remove_html
}
function setup_web {
......
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