Fix email fix

This commit is contained in:
Bob Mottram 2016-12-25 15:25:57 +00:00
parent b19334d0b9
commit ec0a88980c
1 changed files with 6 additions and 4 deletions

View File

@ -55,13 +55,15 @@ function mediagoblin_fix_email {
# does not have mail access
read_config_param 'MEDIAGOBLIN_DOMAIN_NAME'
MEDIAGOBLIN_BASE_DIR=/var/www/$MEDIAGOBLIN_DOMAIN_NAME/htdocs
mgfile=$MEDIAGOBLIN_BASE_DIR/mediagoblin/tools/mail.py
mgfile=$MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin/tools/mail.py
if [ ! -f $mgfile ]; then
echo $'Unable to fix email sending'
exit 792532
fi
if ! grep 'import os' $mgfile; then
sed -i '/import sys/a import os' $mgfile
fi
replacestr='return mhost.sendmail(from_addr, to_addrs, message.as_string())'
newstr="return os.system(\"echo '\" + message_body + \"' | mail -s '\" + message['Subject'] + \"' \" + message['To'])"
sed -i "s|${replacestr}|${newstr}|g" $mgfile
sed -i "s|return mhost.sendmail(from_addr, to_addrs, message.as_string())|return os.system(\"echo '\" + message_body + \"' \| mail -s '\" + message['Subject'] + \"' \" + message['To'])|g" $mgfile
}
function install_interactive_mediagoblin {