rpinit - rohrpost - A commandline mail client to change the world as we see it.
(HTM) git clone git://r-36.net/rohrpost
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
rpinit (4837B)
---
1 #!/bin/sh
2
3 shareprefix="SHAREPREFIX"
4
5 printf "Welcome to Rohrpost!
6
7 Rohrpost is a commandline client for e-mail receiving and sending. It allows
8 this task to be completed in less time than every other e-mail client.
9
10 Let's start initializing your rohrpost setup.\n"
11
12 if [ $# -gt 0 ];
13 then
14 profile="$1"
15 printf "\nYou have selected via commandline to create the '%s' profile.\n" \
16 "$profile"
17 else
18 printf "What should be the name of the profile? > "
19 read -r profile
20 [ $? -gt 0 ] && exit 1
21 fi
22
23 printf "Running rppath -ic \"$profile\".\n"
24 rppath -ic "$profile"
25 [ $? -gt 0 ] && exit 1
26
27 printf "Now the configuration begins.
28
29 Please enter the string value that should appear in the From: header
30 automatically when you create (_rpcomp_), answer (_rprepl_) or forward (_rpfwd_)
31 an e-mail.\n"
32
33 printf "defaultfrom = "
34 read -r defaultfrom
35 [ $? -gt 0 ] && exit 1
36 rpcfg -c "$profile" defaultfrom "$defaultfrom"
37
38 printf "Please enter the network specification of your IMAP server.
39
40 Network specifications are for example:
41 tcp!mail.example.com!imap
42 tcp!mail.example.com!143
43
44 For a direct TLS connection:
45 tcps!mail.example.com!imaps
46 tcps!mail.example.com!993
47
48 Don't be worried, if your server supports STARTTLS, then rohrpost will
49 automatically use it.\n"
50
51 printf "IMAP netspec = "
52 read -r imapnet
53 [ $? -gt 0 ] && exit 1
54 rpcfg -c "$profile" imapnet "$imapnet"
55
56 printf "The login credentials.
57
58 Here rohrpost only supports the PLAIN login method. So be sure to have
59 STARTTLS or a direct SSL/TLS connection to your IMAP server.\n"
60
61 printf "IMAP user = "
62 read -r imapuser
63 [ $? -gt 0 ] && exit 1
64 rpcfg -c "$profile" imapuser "$imapuser"
65
66 printf "IMAP password = "
67 read -r imappass
68 [ $? -gt 0 ] && exit 1
69 rpcfg -c "$profile" imappass "$imappass"
70
71 printf "Sieve configuration.
72
73 For filtering rohrpost is using remote filters and the Managesieve protocol to
74 edit and create sieve filters. The _rpsieve_ command is responsible for this.
75 If you leave the values empty, sieve will not be used.
76
77 For the netspec an example would be:
78 tcp!mail.example.com!4190
79
80 Sieve does not have an SSL/TLS port defined. So be sure to activate STARTTLS
81 in your managesieve server.\n"
82
83 printf "Sieve netspec = "
84 read -r sievenet
85 [ $? -gt 0 ] && exit 1
86 rpcfg -c "$profile" sievenet "$sievenet"
87
88 printf "Sieve user = "
89 read -r sieveuser
90 [ $? -gt 0 ] && exit 1
91 rpcfg -c "$profile" sieveuser "$sieveuser"
92
93 printf "Sieve password = "
94 read -r sievepass
95 [ $? -gt 0 ] && exit 1
96 rpcfg -c "$profile" sievepass "$sievepass"
97
98 printf "\nNow I will set some standard values you can change using the
99 _rpcfg -c "$profile"_ command.\n"
100
101 printf "\nview_msgfilter defines what headers should be shown in the formatted
102 _rpview_ output. Each value is a regexp.
103
104 view_msgfilter = ^newsgroups,^date,^from,^subject,^to,^cc,^bcc,^reply-to,^organisation,^x-mailer,^user-agent\n"
105 rpcfg -c "$profile" view_msgfilter ^newsgroups,^date,^from,^subject,^to,^cc,^bcc,^reply-to,^organisation,^x-mailer,^user-agent
106
107 printf "\ndispose = Trash
108
109 This will tell rohrpost to move all _rprm_ removed e-mails to the 'Trash'
110 folder. Unsetting this _rpcfg -c "$profile"_ key will result in the e-mails being completely
111 removed.\n"
112 rpcfg -c "$profile" dispose Trash
113
114 printf "\nfold_drafts = Drafts, fold_sent = Sent
115
116 Those values define into which folder drafts or sent e-mails should be
117 stored.\n"
118 rpcfg -c "$profile" fold_drafts Drafts
119 rpcfg -c "$profile" fold_sent Sent
120
121 printf "\nsend_cmd = msmtp -t --read-envelope-from
122
123 Send_cmd defines the command that _rpsend_ will pipe the e-mail to during its
124 invocation. (Sending e-mail.) This msmtp default is reading the From: header
125 and will use its value to determine which SMTP credentials and server to use
126 for the e-mail delivery.\n"
127 rpcfg -c "$profile" send_cmd "msmtp -t --read-envelope-from"
128
129 printf "\nDo you want the default output templates to be installed for '%s'? (Y/n) " \
130 "$profile"
131 read -r decision
132 if [ "$decision" != "n" ];
133 then
134 rpbase="$(rppath -c "$profile" -b)/tmpl"
135 if [ -d "$shareprefix/tmpl" ];
136 then
137 cp -rf $shareprefix/tmpl/* "$rpbase"
138 chmod 700 $rpbase/*
139 else
140 printf "ERROR: $shareprefix/tmpl does not exist for copying over the templates\n"
141 fi
142 fi
143
144 printf "\nNow your rohrpost setup is ready!
145
146 Your first step might be to run _rpinc -nu_ to include the status from your
147 IMAP account to the local database. The -n flag will run a script defined in
148 the _runnotify_ key of the _rpcfg -c "$profile"_ database and the -u flag will
149 generate the 'u' sequence of unread e-mails.
150
151 If you don't see any output, try _rpinc -a_, which will show you the status of
152 a(ll) folders. You may need to use _rpfold -s_ to show which folders you are
153 subscribed to (and rohrpost will work on). _rpfold -s folder_ will subscribe
154 to the folder.
155
156 Next you might need to setup msmtp and the advanced topic of local e-mail
157 synchronisation.
158
159 Have fun!\n"
160