瀏覽代碼

Control panel settings for outgoing email proxy

Bob Mottram 9 年之前
父節點
當前提交
6c9062dfaa
共有 2 個文件被更改,包括 228 次插入56 次删除
  1. 155
    49
      src/freedombone-controlpanel
  2. 73
    7
      src/freedombone-controlpanel-user

+ 155
- 49
src/freedombone-controlpanel 查看文件

52
 IRC_PORT=6697
52
 IRC_PORT=6697
53
 IRC_ONION_PORT=8093
53
 IRC_ONION_PORT=8093
54
 
54
 
55
+# outgoing SMTP proxy
56
+SMTP_PROXY_ENABLE=$'no'
57
+SMTP_PROXY_PROTOCOL='smtps'
58
+SMTP_PROXY_SERVER='mail.myispdomain'
59
+SMTP_PROXY_PORT=465
60
+SMTP_PROXY_USERNAME=''
61
+SMTP_PROXY_PASSWORD=''
62
+
55
 USB_DRIVE=sdb
63
 USB_DRIVE=sdb
56
 # get default USB from config file
64
 # get default USB from config file
57
 CONFIGURATION_FILE=/root/${PROJECT_NAME}.cfg
65
 CONFIGURATION_FILE=/root/${PROJECT_NAME}.cfg
68
     if grep -q "IRC_PORT=" $CONFIGURATION_FILE; then
76
     if grep -q "IRC_PORT=" $CONFIGURATION_FILE; then
69
         IRC_PORT=$(cat $CONFIGURATION_FILE | grep "IRC_PORT=" | awk -F '=' '{print $2}')
77
         IRC_PORT=$(cat $CONFIGURATION_FILE | grep "IRC_PORT=" | awk -F '=' '{print $2}')
70
     fi
78
     fi
79
+
80
+    if grep -q "SMTP_PROXY_ENABLE=" $CONFIGURATION_FILE; then
81
+        SMTP_PROXY_ENABLE=$(cat $CONFIGURATION_FILE | grep "SMTP_PROXY_ENABLE=" | awk -F '=' '{print $2}')
82
+    fi
83
+    if grep -q "SMTP_PROXY_PROTOCOL=" $CONFIGURATION_FILE; then
84
+        SMTP_PROXY_PROTOCOL=$(cat $CONFIGURATION_FILE | grep "SMTP_PROXY_PROTOCOL=" | awk -F '=' '{print $2}')
85
+    fi
86
+    if grep -q "SMTP_PROXY_SERVER=" $CONFIGURATION_FILE; then
87
+        SMTP_PROXY_SERVER=$(cat $CONFIGURATION_FILE | grep "SMTP_PROXY_SERVER=" | awk -F '=' '{print $2}')
88
+    fi
89
+    if grep -q "SMTP_PROXY_PORT=" $CONFIGURATION_FILE; then
90
+        SMTP_PROXY_PORT=$(cat $CONFIGURATION_FILE | grep "SMTP_PROXY_PORT=" | awk -F '=' '{print $2}')
91
+    fi
92
+    if grep -q "SMTP_PROXY_USERNAME=" $CONFIGURATION_FILE; then
93
+        SMTP_PROXY_USERNAME=$(cat $CONFIGURATION_FILE | grep "SMTP_PROXY_USERNAME=" | awk -F '=' '{print $2}')
94
+    fi
95
+    if grep -q "SMTP_PROXY_PASSWORD=" $CONFIGURATION_FILE; then
96
+        SMTP_PROXY_PASSWORD=$(cat $CONFIGURATION_FILE | grep "SMTP_PROXY_PASSWORD=" | awk -F '=' '{print $2}')
97
+    fi
71
 fi
98
 fi
72
 
99
 
73
 # Mirrors settings
100
 # Mirrors settings
138
     dialog --backtitle $"Freedombone Control Panel" \
165
     dialog --backtitle $"Freedombone Control Panel" \
139
            --title $"Main Repository (Mirrors)" \
166
            --title $"Main Repository (Mirrors)" \
140
            --form $"If you do not wish to use the default repositories they can be obtained from mirrors on another ${PROJECT_NAME} server." 14 60 3 \
167
            --form $"If you do not wish to use the default repositories they can be obtained from mirrors on another ${PROJECT_NAME} server." 14 60 3 \
141
-              $"URL:" 1 1 "$FRIENDS_MIRRORS_SERVER" 1 14 40 15 \
142
-              $"SSH Port:" 2 1 "$FRIENDS_MIRRORS_SSH_PORT" 2 14 40 10000 \
143
-              $"Password:" 3 1 "$FRIENDS_MIRRORS_PASSWORD" 3 14 40 10000 \
144
-              2> $data
168
+           $"URL:" 1 1 "$FRIENDS_MIRRORS_SERVER" 1 14 40 15 \
169
+           $"SSH Port:" 2 1 "$FRIENDS_MIRRORS_SSH_PORT" 2 14 40 10000 \
170
+           $"Password:" 3 1 "$FRIENDS_MIRRORS_PASSWORD" 3 14 40 10000 \
171
+           2> $data
145
     sel=$?
172
     sel=$?
146
     case $sel in
173
     case $sel in
147
         1) return;;
174
         1) return;;
200
     dialog --backtitle $"Freedombone Control Panel" \
227
     dialog --backtitle $"Freedombone Control Panel" \
201
            --title $"Add new user" \
228
            --title $"Add new user" \
202
            --form "\n" 8 60 3 \
229
            --form "\n" 8 60 3 \
203
-              $"Username:" 1 1 "" 1 28 16 15 \
204
-              $"ssh public key (optional):" 2 1 "" 2 28 40 10000 \
205
-              2> $data
230
+           $"Username:" 1 1 "" 1 28 16 15 \
231
+           $"ssh public key (optional):" 2 1 "" 2 28 40 10000 \
232
+           2> $data
206
     sel=$?
233
     sel=$?
207
     case $sel in
234
     case $sel in
208
         1) return;;
235
         1) return;;
453
     fi
480
     fi
454
 }
481
 }
455
 
482
 
483
+function smtp_proxy {
484
+    MUTTRC_FILE=/home/$ADMIN_USER/.muttrc
485
+    if [ ! -f $MUTTRC_FILE ]; then
486
+        return
487
+    fi
488
+    
489
+    data=$(tempfile 2>/dev/null)
490
+    trap "rm -f $data" 0 1 2 5 15
491
+    dialog --backtitle $"Freedombone Control Panel" \
492
+           --title $"SMTP Proxy for $ADMIN_USER" \
493
+           --form $"You may need to proxy outgoing email via your ISP's mail server. If so enter the details below." 14 75 6 \
494
+           $"Enable proxy:" 1 1 "$SMTP_PROXY_ENABLE" 1 24 5 5 \
495
+           $"Protocol (smtp/smtps):" 2 1 "$SMTP_PROXY_PROTOCOL" 2 24 5 5 \
496
+           $"ISP mail server:" 3 1 "$SMTP_PROXY_SERVER" 3 24 40 10000 \
497
+           $"Port:" 4 1 "$SMTP_PROXY_PORT" 4 24 5 5 \
498
+           $"Username:" 5 1 "$SMTP_PROXY_USERNAME" 5 24 40 10000 \
499
+           $"Password:" 6 1 "$SMTP_PROXY_PASSWORD" 6 24 40 10000 \
500
+           2> $data
501
+    sel=$?
502
+    case $sel in
503
+        1) return;;
504
+        255) return;;
505
+    esac
506
+    SMTP_PROXY_ENABLE=$(cat $data | sed -n 1p)
507
+    SMTP_PROXY_PROTOCOL=$(cat $data | sed -n 2p)
508
+    SMTP_PROXY_SERVER=$(cat $data | sed -n 3p)
509
+    SMTP_PROXY_PORT=$(cat $data | sed -n 4p)
510
+    SMTP_PROXY_USERNAME=$(cat $data | sed -n 5p)
511
+    SMTP_PROXY_PASSWORD=$(cat $data | sed -n 6p)
512
+
513
+    # change muttrc
514
+    if [ $SMTP_PROXY_ENABLE != $'no' ]; then
515
+        if ! grep "set smtp_url" $MUTTRC_FILE; then
516
+            echo "set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"" >> $MUTTRC_FILE
517
+        else
518
+            sed -i "s|set smtp_url=.*|set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"|g" $MUTTRC_FILE
519
+        fi          
520
+        sed -i 's|#set smtp_url|set smtp_url|g' $MUTTRC_FILE
521
+    else
522
+        if grep "set smtp_url" $MUTTRC_FILE; then
523
+            sed -i 's|set smtp_url|#set smtp_url|g' $MUTTRC_FILE
524
+        fi
525
+    fi
526
+
527
+    # save settings within the main configuration file
528
+    if ! grep -q "SMTP_PROXY_ENABLE=" $CONFIGURATION_FILE; then
529
+        echo "SMTP_PROXY_ENABLE=$SMTP_PROXY_ENABLE" >> $CONFIGURATION_FILE
530
+    else
531
+        sed -i "s|SMTP_PROXY_ENABLE=.*|SMTP_PROXY_ENABLE=$SMTP_PROXY_ENABLE|g" $CONFIGURATION_FILE
532
+    fi
533
+    if ! grep -q "SMTP_PROXY_PROTOCOL=" $CONFIGURATION_FILE; then
534
+        echo "SMTP_PROXY_PROTOCOL=$SMTP_PROXY_PROTOCOL" >> $CONFIGURATION_FILE
535
+    else
536
+        sed -i "s|SMTP_PROXY_PROTOCOL=.*|SMTP_PROXY_PROTOCOL=$SMTP_PROXY_PROTOCOL|g" $CONFIGURATION_FILE
537
+    fi
538
+    if ! grep -q "SMTP_PROXY_SERVER=" $CONFIGURATION_FILE; then
539
+        echo "SMTP_PROXY_SERVER=$SMTP_PROXY_SERVER" >> $CONFIGURATION_FILE
540
+    else
541
+        sed -i "s|SMTP_PROXY_SERVER=.*|SMTP_PROXY_SERVER=$SMTP_PROXY_SERVER|g" $CONFIGURATION_FILE
542
+    fi
543
+    if ! grep -q "SMTP_PROXY_PORT=" $CONFIGURATION_FILE; then
544
+        echo "SMTP_PROXY_PORT=$SMTP_PROXY_PORT" >> $CONFIGURATION_FILE
545
+    else
546
+        sed -i "s|SMTP_PROXY_PORT=.*|SMTP_PROXY_PORT=$SMTP_PROXY_PORT|g" $CONFIGURATION_FILE
547
+    fi
548
+    if ! grep -q "SMTP_PROXY_USERNAME=" $CONFIGURATION_FILE; then
549
+        echo "SMTP_PROXY_USERNAME=$SMTP_PROXY_USERNAME" >> $CONFIGURATION_FILE
550
+    else
551
+        sed -i "s|SMTP_PROXY_USERNAME=.*|SMTP_PROXY_USERNAME=$SMTP_PROXY_USERNAME|g" $CONFIGURATION_FILE
552
+    fi
553
+    if ! grep -q "SMTP_PROXY_PASSWORD=" $CONFIGURATION_FILE; then
554
+        echo "SMTP_PROXY_PASSWORD=$SMTP_PROXY_PASSWORD" >> $CONFIGURATION_FILE
555
+    else
556
+        sed -i "s|SMTP_PROXY_PASSWORD=.*|SMTP_PROXY_PASSWORD=$SMTP_PROXY_PASSWORD|g" $CONFIGURATION_FILE
557
+    fi
558
+}
559
+
456
 function delete_user {
560
 function delete_user {
457
     select_user
561
     select_user
458
     if [ ! $SELECTED_USERNAME ]; then
562
     if [ ! $SELECTED_USERNAME ]; then
714
     dialog --backtitle $"Freedombone Control Panel" \
818
     dialog --backtitle $"Freedombone Control Panel" \
715
            --title $"Subscribe $SELECTED_USERNAME to a mailing list" \
819
            --title $"Subscribe $SELECTED_USERNAME to a mailing list" \
716
            --form $"You can either enter a subject or an email address\n" 11 68 4 \
820
            --form $"You can either enter a subject or an email address\n" 11 68 4 \
717
-              $"List folder name:" 1 1 "" 1 35 26 25 \
718
-              $"Name between [] on subject line:" 2 1 "" 2 35 26 25 \
719
-              $"List email address:" 3 1 "" 3 35 26 25 \
720
-              $"Public:" 4 1 $"yes" 4 35 4 25 \
721
-              2> $data
821
+           $"List folder name:" 1 1 "" 1 35 26 25 \
822
+           $"Name between [] on subject line:" 2 1 "" 2 35 26 25 \
823
+           $"List email address:" 3 1 "" 3 35 26 25 \
824
+           $"Public:" 4 1 $"yes" 4 35 4 25 \
825
+           2> $data
722
     sel=$?
826
     sel=$?
723
     case $sel in
827
     case $sel in
724
         1) return;;
828
         1) return;;
777
     dialog --backtitle $"Freedombone Control Panel" \
881
     dialog --backtitle $"Freedombone Control Panel" \
778
            --title $"Email rule for user $SELECTED_USERNAME" \
882
            --title $"Email rule for user $SELECTED_USERNAME" \
779
            --form "\n" 9 65 4 \
883
            --form "\n" 9 65 4 \
780
-              $"When email arrives from address:" 1 1 "" 1 35 24 28 \
781
-              $"Move to folder:" 2 1 "" 2 35 24 28 \
782
-              $"Public:" 3 1 $"no" 3 35 4 25 \
783
-              2> $data
884
+           $"When email arrives from address:" 1 1 "" 1 35 24 28 \
885
+           $"Move to folder:" 2 1 "" 2 35 24 28 \
886
+           $"Public:" 3 1 $"no" 3 35 4 25 \
887
+           2> $data
784
     sel=$?
888
     sel=$?
785
     case $sel in
889
     case $sel in
786
         1) return;;
890
         1) return;;
815
     fi
919
     fi
816
 
920
 
817
     ${PROJECT_NAME}-addemail -u $SELECTED_USERNAME -e "$RULE_EMAIL" \
921
     ${PROJECT_NAME}-addemail -u $SELECTED_USERNAME -e "$RULE_EMAIL" \
818
-                         -g "$RULE_FOLDER" --public $RULE_PUBLIC
922
+                   -g "$RULE_FOLDER" --public $RULE_PUBLIC
819
     dialog --title $"Add email rule" \
923
     dialog --title $"Add email rule" \
820
            --msgbox $"Email rule for $RULE_EMAIL was added" 6 40
924
            --msgbox $"Email rule for $RULE_EMAIL was added" 6 40
821
 }
925
 }
831
     dialog --backtitle $"Freedombone Control Panel" \
935
     dialog --backtitle $"Freedombone Control Panel" \
832
            --title "$blockstr $SELECTED_USERNAME" \
936
            --title "$blockstr $SELECTED_USERNAME" \
833
            --form "\n" 8 65 3 \
937
            --form "\n" 8 65 3 \
834
-              $"When email arrives from address:" 1 1 "" 1 35 24 100 \
835
-              $"Block it:" 2 1 "yes" 2 35 4 4 \
836
-              2> $data
938
+           $"When email arrives from address:" 1 1 "" 1 35 24 100 \
939
+           $"Block it:" 2 1 "yes" 2 35 4 4 \
940
+           2> $data
837
     sel=$?
941
     sel=$?
838
     case $sel in
942
     case $sel in
839
         1) return;;
943
         1) return;;
873
     dialog --backtitle $"Freedombone Control Panel" \
977
     dialog --backtitle $"Freedombone Control Panel" \
874
            --title "$blockstr $SELECTED_USERNAME" \
978
            --title "$blockstr $SELECTED_USERNAME" \
875
            --form "\n" 8 70 3 \
979
            --form "\n" 8 70 3 \
876
-              $"When email arrives with subject text:" 1 1 "" 1 40 24 28 \
877
-              $"Block it:" 2 1 "yes" 2 40 4 4 \
878
-              2> $data
980
+           $"When email arrives with subject text:" 1 1 "" 1 40 24 28 \
981
+           $"Block it:" 2 1 "yes" 2 40 4 4 \
982
+           2> $data
879
     sel=$?
983
     sel=$?
880
     case $sel in
984
     case $sel in
881
         1) return;;
985
         1) return;;
1216
     echo ' '
1320
     echo ' '
1217
     echo '
1321
     echo '
1218
 
1322
 
1219
-' | reset-tripwire
1323
+                ' | reset-tripwire
1220
     any_key
1324
     any_key
1221
 }
1325
 }
1222
 
1326
 
1704
         trap "rm -f $data" 0 1 2 5 15
1808
         trap "rm -f $data" 0 1 2 5 15
1705
         dialog --backtitle $"Freedombone Control Panel" \
1809
         dialog --backtitle $"Freedombone Control Panel" \
1706
                --title $"Control Panel" \
1810
                --title $"Control Panel" \
1707
-               --radiolist $"Choose an operation:" 26 70 19 \
1811
+               --radiolist $"Choose an operation:" 27 70 20 \
1708
                1 $"About this system" off \
1812
                1 $"About this system" off \
1709
                2 $"Backup and Restore" off \
1813
                2 $"Backup and Restore" off \
1710
                3 $"Reset Tripwire" off \
1814
                3 $"Reset Tripwire" off \
1712
                5 $"Ping enable/disable" off \
1816
                5 $"Ping enable/disable" off \
1713
                6 $"Manage Users" off \
1817
                6 $"Manage Users" off \
1714
                7 $"Email Filtering Rules" off \
1818
                7 $"Email Filtering Rules" off \
1715
-               8 $"Security Settings" off \
1716
-               9 $"Set the main repository (repo mirrors)" off \
1717
-               10 $"Hubzilla" off \
1718
-               11 $"Media menu" off \
1719
-               12 $"IRC menu" off \
1720
-               13 $"Change the name of this system" off \
1721
-               14 $"Set the TLS date/time source" off \
1722
-               15 $"Set a static local IP address" off \
1723
-               16 $"Check for updates" off \
1724
-               17 $"Power off the system" off \
1725
-               18 $"Restart the system" off \
1726
-               19 $"Exit" on 2> $data
1819
+               8 $"Outgoing Email Proxy" off \
1820
+               9 $"Security Settings" off \
1821
+               10 $"Set the main repository (repo mirrors)" off \
1822
+               11 $"Hubzilla" off \
1823
+               12 $"Media menu" off \
1824
+               13 $"IRC menu" off \
1825
+               14 $"Change the name of this system" off \
1826
+               15 $"Set the TLS date/time source" off \
1827
+               16 $"Set a static local IP address" off \
1828
+               17 $"Check for updates" off \
1829
+               18 $"Power off the system" off \
1830
+               19 $"Restart the system" off \
1831
+               20 $"Exit" on 2> $data
1727
         sel=$?
1832
         sel=$?
1728
         case $sel in
1833
         case $sel in
1729
             1) exit 1;;
1834
             1) exit 1;;
1737
             5) ping_enable_disable;;
1842
             5) ping_enable_disable;;
1738
             6) menu_users;;
1843
             6) menu_users;;
1739
             7) menu_email;;
1844
             7) menu_email;;
1740
-            8) security_settings;;
1741
-            9) set_main_repo;;
1742
-            10) menu_hubzilla;;
1743
-            11) menu_media;;
1744
-            12) menu_irc;;
1745
-            13) change_system_name;;
1746
-            14) set_tls_time_source;;
1747
-            15) set_static_IP;;
1748
-            16) check_for_updates;;
1749
-            17) shut_down_system;;
1750
-            18) restart_system;;
1751
-            19) break;;
1845
+            8) smtp_proxy;;
1846
+            9) security_settings;;
1847
+            10) set_main_repo;;
1848
+            11) menu_hubzilla;;
1849
+            12) menu_media;;
1850
+            13) menu_irc;;
1851
+            14) change_system_name;;
1852
+            15) set_tls_time_source;;
1853
+            16) set_static_IP;;
1854
+            17) check_for_updates;;
1855
+            18) shut_down_system;;
1856
+            19) restart_system;;
1857
+            20) break;;
1752
         esac
1858
         esac
1753
     done
1859
     done
1754
 }
1860
 }

+ 73
- 7
src/freedombone-controlpanel-user 查看文件

475
     esac
475
     esac
476
 }
476
 }
477
 
477
 
478
+function smtp_proxy {
479
+    MUTTRC_FILE=/home/$USER/.muttrc
480
+    if [ ! -f $MUTTRC_FILE ]; then
481
+        return
482
+    fi
483
+    SMTP_PROXY_ENABLE=$'no'
484
+    SMTP_PROXY_PROTOCOL='smtps'
485
+    SMTP_PROXY_SERVER='mail.myispdomain'
486
+    SMTP_PROXY_PORT=465
487
+    SMTP_PROXY_USERNAME=''
488
+    SMTP_PROXY_PASSWORD=''
489
+
490
+    if grep -q "set smtp_url" $MUTTRC_FILE; then
491
+        if grep -q "#set smtp_url" $MUTTRC_FILE; then
492
+            SMTP_PROXY_ENABLE=$'no'
493
+        else
494
+            SMTP_PROXY_ENABLE=$'yes'
495
+        fi      
496
+        SMTP_PROXY_PROTOCOL=$(cat $MUTTRC_FILE | grep "set smtp_url" | awk -F '"' '{print $2}' | awk -F ':' '{print $1}')
497
+        SMTP_PROXY_SERVER=$(cat $MUTTRC_FILE | grep "set smtp_url" | awk -F '"' '{print $2}' | awk -F '/' '{print $3}' | awk -F ':' '{print $2}' | awk -F '@' '{print $2}')
498
+        SMTP_PROXY_PORT=$(cat $MUTTRC_FILE | grep "set smtp_url" | awk -F ':' '{print $4}' | awk -F '/' '{print $1}')
499
+        SMTP_PROXY_USERNAME=$(cat $MUTTRC_FILE | grep "set smtp_url" | awk -F '"' '{print $2}' | awk -F '/' '{print $3}' | awk -F ':' '{print $1}')
500
+        SMTP_PROXY_PASSWORD=$(cat $MUTTRC_FILE | grep "set smtp_url" | awk -F '"' '{print $2}' | awk -F '/' '{print $3}' | awk -F ':' '{print $2}' | awk -F '@' '{print $1}')
501
+    fi
502
+    
503
+    data=$(tempfile 2>/dev/null)
504
+    trap "rm -f $data" 0 1 2 5 15
505
+    dialog --backtitle $"Freedombone Control Panel" \
506
+           --title $"SMTP Proxy for $USER" \
507
+           --form $"You may need to proxy outgoing email via your ISP's mail server. If so enter the details below." 14 75 6 \
508
+           $"Enable proxy:" 1 1 "$SMTP_PROXY_ENABLE" 1 24 5 5 \
509
+           $"Protocol (smtp/smtps):" 2 1 "$SMTP_PROXY_PROTOCOL" 2 24 5 5 \
510
+           $"ISP mail server:" 3 1 "$SMTP_PROXY_SERVER" 3 24 40 10000 \
511
+           $"Port:" 4 1 "$SMTP_PROXY_PORT" 4 24 5 5 \
512
+           $"Username:" 5 1 "$SMTP_PROXY_USERNAME" 5 24 40 10000 \
513
+           $"Password:" 6 1 "$SMTP_PROXY_PASSWORD" 6 24 40 10000 \
514
+           2> $data
515
+    sel=$?
516
+    case $sel in
517
+        1) return;;
518
+        255) return;;
519
+    esac
520
+    SMTP_PROXY_ENABLE=$(cat $data | sed -n 1p)
521
+    SMTP_PROXY_PROTOCOL=$(cat $data | sed -n 2p)
522
+    SMTP_PROXY_SERVER=$(cat $data | sed -n 3p)
523
+    SMTP_PROXY_PORT=$(cat $data | sed -n 4p)
524
+    SMTP_PROXY_USERNAME=$(cat $data | sed -n 5p)
525
+    SMTP_PROXY_PASSWORD=$(cat $data | sed -n 6p)
526
+
527
+    # change muttrc
528
+    if [ $SMTP_PROXY_ENABLE != $'no' ]; then
529
+        if ! grep -q "set smtp_url" $MUTTRC_FILE; then
530
+            echo "set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"" >> $MUTTRC_FILE
531
+        else
532
+            sed -i "s|set smtp_url=.*|set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"|g" $MUTTRC_FILE
533
+        fi          
534
+        sed -i 's|#set smtp_url|set smtp_url|g' $MUTTRC_FILE
535
+    else
536
+        if grep "set smtp_url" $MUTTRC_FILE; then
537
+            sed -i 's|set smtp_url|#set smtp_url|g' $MUTTRC_FILE
538
+        fi
539
+    fi
540
+}
541
+
478
 function menu_encryption_keys {
542
 function menu_encryption_keys {
479
     while true
543
     while true
480
     do
544
     do
559
         trap "rm -f $data" 0 1 2 5 15
623
         trap "rm -f $data" 0 1 2 5 15
560
         dialog --backtitle $"Freedombone User Control Panel" \
624
         dialog --backtitle $"Freedombone User Control Panel" \
561
                --title $"User Control Panel" \
625
                --title $"User Control Panel" \
562
-               --radiolist $"Choose an operation:" 17 50 10 \
626
+               --radiolist $"Choose an operation:" 18 50 11 \
563
                1 $"Use Email" off \
627
                1 $"Use Email" off \
564
                2 $"Change Email Filtering Rules" off \
628
                2 $"Change Email Filtering Rules" off \
565
                3 $"Use Tox Chat" off \
629
                3 $"Use Tox Chat" off \
567
                5 $"Use IRC" off \
631
                5 $"Use IRC" off \
568
                6 $"Browse the Web" off \
632
                6 $"Browse the Web" off \
569
                7 $"Your Encryption Keys" off \
633
                7 $"Your Encryption Keys" off \
570
-               8 $"Administrator controls" off \
571
-               9 $"Exit to the command line" off \
572
-               10 $"Log out" on 2> $data
634
+               8 $"Set an outgoing email proxy" off \
635
+               9 $"Administrator controls" off \
636
+               10 $"Exit to the command line" off \
637
+               11 $"Log out" on 2> $data
573
         sel=$?
638
         sel=$?
574
         case $sel in
639
         case $sel in
575
             1) exit 1;;
640
             1) exit 1;;
583
             5) torify irssi;;
648
             5) torify irssi;;
584
             6) torify elinks;;
649
             6) torify elinks;;
585
             7) menu_encryption_keys;;
650
             7) menu_encryption_keys;;
586
-            8) menu_admin;;
587
-            9) break;;
588
-            10) kill -HUP `pgrep -s 0 -o`;;
651
+            8) smtp_proxy;;
652
+            9) menu_admin;;
653
+            10) break;;
654
+            11) kill -HUP `pgrep -s 0 -o`;;
589
         esac
655
         esac
590
     done
656
     done
591
 }
657
 }