Browse Source

Fix email fix

Bob Mottram 8 years ago
parent
commit
ec0a88980c
1 changed files with 6 additions and 4 deletions
  1. 6
    4
      src/freedombone-app-mediagoblin

+ 6
- 4
src/freedombone-app-mediagoblin View File

55
     # does not have mail access
55
     # does not have mail access
56
     read_config_param 'MEDIAGOBLIN_DOMAIN_NAME'
56
     read_config_param 'MEDIAGOBLIN_DOMAIN_NAME'
57
     MEDIAGOBLIN_BASE_DIR=/var/www/$MEDIAGOBLIN_DOMAIN_NAME/htdocs
57
     MEDIAGOBLIN_BASE_DIR=/var/www/$MEDIAGOBLIN_DOMAIN_NAME/htdocs
58
-    mgfile=$MEDIAGOBLIN_BASE_DIR/mediagoblin/tools/mail.py
58
+    mgfile=$MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin/tools/mail.py
59
+    if [ ! -f $mgfile ]; then
60
+        echo $'Unable to fix email sending'
61
+        exit 792532
62
+    fi
59
     if ! grep 'import os' $mgfile; then
63
     if ! grep 'import os' $mgfile; then
60
         sed -i '/import sys/a import os' $mgfile
64
         sed -i '/import sys/a import os' $mgfile
61
     fi
65
     fi
62
-    replacestr='return mhost.sendmail(from_addr, to_addrs, message.as_string())'
63
-    newstr="return os.system(\"echo '\" + message_body + \"' | mail -s '\" + message['Subject'] + \"' \" + message['To'])"
64
-    sed -i "s|${replacestr}|${newstr}|g" $mgfile
66
+    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
65
 }
67
 }
66
 
68
 
67
 function install_interactive_mediagoblin {
69
 function install_interactive_mediagoblin {