Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

444 lignes
16 KiB

  1. #!/bin/sh
  2. if [ "$#" -gt 1 ]; then
  3. echo "To many arguments. You will be asked."
  4. exit
  5. fi
  6. if [ -z "$prefix" ]; then
  7. case "$(uname)" in
  8. Linux) prefix="/usr" ;;
  9. *) prefix="/usr/local" ;;
  10. esac
  11. fi
  12. command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2"
  13. [ -z "$PASSWORD_STORE_DIR" ] && PASSWORD_STORE_DIR="$HOME/.password-store"
  14. [ -r "$PASSWORD_STORE_DIR/.gpg-id" ] &&
  15. "$GPG" --list-secret-keys $(cat "$PASSWORD_STORE_DIR/.gpg-id") >/dev/null 2>&1 || {
  16. printf "\`pass\` must be installed and initialized to encrypt passwords.\\nBe sure it is installed and run \`pass init <yourgpgemail>\`.\\nIf you don't have a GPG public private key pair, run \`$GPG --full-gen-key\` first.\\n"
  17. exit
  18. }
  19. ! command -v "$prefix/bin/mbsync" >/dev/null && printf "\`mbsync\` must be installed to run mutt-wizard.\\n" && exit
  20. ! command -v "$prefix/bin/msmtp" >/dev/null && printf "\`msmtp\` must be installed.\\n" && exit
  21. ! ( command -v mutt >/dev/null || command -v neomutt >/dev/null ) && printf "\`mutt\` must be installed.\\n" && exit
  22. mwconfigdir=${XDG_CONFIG_HOME:-$HOME/.config}
  23. # Main mutt config location
  24. mwmuttdir="$mwconfigdir/mutt"
  25. # Directory for account settings
  26. mwaccmuttdir="$mwmuttdir/accounts"
  27. # Location of mail storage
  28. mwmaildir="${MAILDIR:-$HOME/mail}"
  29. # Regex to confirm valid email address
  30. mwemailre=".\+@.\+\\..\+"
  31. mwshare="$prefix/share/mutt-wizard"
  32. mwmuttrc="$mwmuttdir/muttrc"
  33. mwmbsyncrc="$mwconfigdir/isync/mbsyncrc"
  34. mwmsmtprc="$mwconfigdir/msmtp/config"
  35. mwsharerc="$mwshare/mutt-wizard.muttrc"
  36. mwcachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard"
  37. mwssltype="IMAPS"
  38. mbsyncbin="$prefix/bin/mbsync -c $mwmbsyncrc"
  39. msmtpbin="$prefix/bin/msmtp"
  40. _mwaddrmwtype(){
  41. mwacc="$mwaddr" # let the user always just deal with his email
  42. mwaccmutt="${mwaddr//[.@]/_}" # but mutt would not show it with an @ or .
  43. mwacccachedir=$mwcachedir/${mwaddr//[.@]/_} # @ cannot stay because of mutt, . could
  44. mwaccmaildir="$mwmaildir/$mwaccmutt" # folder name as shown by mutt and opens with gf in vim
  45. mwaccmuttrc="$mwaccmuttdir/$mwidnum-$mwacc.mwonofftype.$mwtype.muttrc"
  46. mwpass=mutt-wizard-$mwaddr
  47. [ -n "$mwidnum" ] && mwaccmuttrc="$mwaccmuttdir/$mwidnum-$mwacc.mwonofftype.$mwtype.muttrc"
  48. }
  49. for mwcrt in "/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" "/etc/ssl/cert.pem" "/usr/local/share/ca-certificates/"
  50. do
  51. [ -f "$mwcrt" ] && mwsslcert="$mwcrt" && break
  52. done || { echo "CA Certificate not found. Please install one or link it to /etc/ssl/certs/ca-certificates.crt" && exit 1 ;}
  53. _mwgetaccounts() {
  54. mwaccounts="$(find "$mwaccmuttdir" -type f | grep -o "[1-9]-.*.muttrc" | sed "s/-/: /;s/\.muttrc//" | sort -n)"
  55. }
  56. _mwlist() {
  57. _mwgetaccounts && [ -n "$mwaccounts" ] && echo "${mwaccounts//.mwonofftype./ }"
  58. }
  59. _mwadd() {
  60. _mwasktype && _mwaskinfo && _mwtryconnect && _mwfinalize || _mwdelete
  61. }
  62. _mwgetprofiles() {
  63. unset mwmsmtpheader mwmsmtpprofile mwmuttprofile mwmbsyncprofile
  64. printf "Creating profiles for \`%s\`..." "$mwaddr"
  65. mwmsmtpheader="defaults
  66. auth on
  67. tls on
  68. tls_trust_file $mwsslcert
  69. logfile ${XDG_LOG_HOME:-$HOME}/msmtp.log
  70. "
  71. mwmsmtpprofile="account $mwacc
  72. host $mwsmtp
  73. port $mwsport
  74. from $mwaddr
  75. user $mwlogin
  76. passwordeval \"pass $mwpass\"
  77. $mwstarttlsoff
  78. "
  79. mwmbsyncprofile="IMAPStore $mwacc-remote
  80. Host $mwimap
  81. Port $mwiport
  82. User $mwlogin
  83. PassCmd \"pass $mwpass\"
  84. SSLType $mwssltype
  85. CertificateFile $mwsslcert
  86. MaildirStore $mwacc-local
  87. Subfolders Verbatim
  88. Path $mwaccmaildir/
  89. Inbox $mwaccmaildir/INBOX
  90. Flatten .
  91. Channel $mwacc
  92. Expunge Both
  93. Master :$mwacc-remote:
  94. Slave :$mwacc-local:
  95. Patterns * !\"[Gmail]/All Mail\"
  96. Create Both
  97. SyncState *
  98. MaxMessages 0
  99. # End profile
  100. "
  101. if [ "$mwtype" = "offline" ]; then
  102. mwmuttprofile="# vim: filetype=neomuttrc
  103. # muttrc file for account $mwaddr
  104. set realname = \"$mwname\"
  105. set from = \"$mwaddr\"
  106. set sendmail = \"$msmtpbin -a $mwacc\"
  107. alias me $mwname <$mwaddr>
  108. set folder = \"$mwaccmaildir\"
  109. set mbox_type = Maildir
  110. macro index gm \"<shell-escape>mailsync $mwacc<enter>\" \"sync mail $mwaddr\"
  111. unmailboxes *
  112. "
  113. else
  114. mwmuttprofile="# vim: filetype=neomuttrc
  115. # muttrc file for account $mwaddr
  116. set realname = \"$mwname\"
  117. set from = \"$mwaddr\"
  118. set sendmail = \"$msmtpbin -a $mwacc\"
  119. alias me $mwname <$mwaddr>
  120. set folder = \"imaps://$mwaddr@$mwimap:$mwiport\"
  121. set header_cache = \"$mwacccachedir\"
  122. set message_cachedir = \$header_cache
  123. set imap_user = \"$mwlogin\"
  124. set imap_pass = \"\`pass $mwpass\`\"
  125. account-hook \$folder 'set imap_user=\"$mwlogin\" imap_pass=\"\`pass $mwpass\`\"'
  126. set mbox_type = Maildir
  127. set ssl_starttls = yes
  128. set ssl_force_tls = yes
  129. unmailboxes *
  130. "
  131. fi
  132. printf "DONE.\\n"
  133. }
  134. _mwaskinfo() {
  135. if [ -z "$mwaddr" ]; then
  136. printf "Type the \033[31memail address\033[0m\\n\t\033[36m"
  137. read -r mwaddr
  138. printf "\033[0m"
  139. while ! echo "$mwaddr" | grep "$mwemailre" >/dev/null; do
  140. printf "That is not a valid \033[31memail address\033[0m, please retype\\n\t\033[36m"
  141. read -r mwaddr
  142. printf "\033[0m"
  143. done
  144. fi
  145. mwdomain="$(echo "$mwaddr" | sed "s/.*@//")"
  146. printf "\\nSearching for \033[32m%s\033[0m in \033[34m\`domains.csv\`\033[0m..." "$mwdomain"
  147. mwserverinfo="$(grep "^$mwdomain" "$mwshare/domains.csv" 2>/dev/null)"
  148. if [ -z "$mwserverinfo" ]; then
  149. printf "Your email domain is not known to mutt-wizard.\\nType in your settings.\\nUsually you find them by an internet search.\\n"
  150. printf "Type the IMAP server (excluding the port number)\\n\033[36m\t"
  151. read -r mwimap
  152. printf "\033[0mIMAP port number (usually 993)\\n\033[36m\t"
  153. read -r mwiport
  154. printf "\033[0mSMTP server (excluding the port number)\\n\033[36m\t"
  155. read -r mwsmtp
  156. printf "\033[0mSMTP port number (usually 587 or 465)\\n\033[36m\t"
  157. read -r mwsport
  158. printf "\033[0m\\nIf you want, you can copy the line below and add it to the \`domains.csv\` file on Github, for others.\\n\\n%s,%s,%s,%s,%s\\n\\nBut be sure the setting works, first! ;-)\\n" "$mwdomain" "$mwimap" "$mwiport" "$mwsmtp" "$mwsport"
  159. else
  160. IFS=, read -r mwservice mwimap mwiport mwsmtp mwsport <<EOF
  161. $mwserverinfo
  162. EOF
  163. printf "\\n\033[3;33mCongrats!\033[0m Server info is known, so you don't need to look it up!\\n\t\033[1mIMAP server\033[0m: %s\\n\t\033[1mIMAP port\033[0m: %s\\n\t\033[1mSMTP server\033[0m: %s\\n\t\033[1mSMTP port\033[0m: %s\\n" "$mwimap" "$mwiport" "$mwsmtp" "$mwsport"
  164. case "$mwservice" in
  165. gmail.com) printf "\033[31mGmail: \"less secure\" must be enabled before you continue.\\nDo it now, if you have not done it already:\\nhttps://support.google.com/accounts/answer/6010255\\n\033[0m" ;;
  166. protonmail.ch|protonmail.com|pm.me) printf "\033[31mProtonmail: Users must install and configure Protonmail Bridge for the sync to work:\\nhttps://protonmail.com/bridge/\\n\033[0m" && ssltype="None" ;;
  167. esac
  168. [ "$mwsport" = 465 ] && mwstarttlsoff="tls_starttls off"
  169. fi
  170. if [ -z "$mwname" ]; then
  171. printf "Name to associate to email.\\n\t"
  172. read -r mwname
  173. fi
  174. if [ -z "$mwlogin" ]; then
  175. printf "Type your account username if different from your email address.\\n\033[34mFor most accounts you can probably leave this blank.\033[0m\\n\tLogin(?): \033[36m"
  176. read -r mwlogin
  177. printf "\033[0m"
  178. [ -z "$mwlogin" ] && mwlogin="$mwaddr"
  179. fi
  180. # if the user has a pass entry he could provide it via mwpass
  181. if [ -z "$mwpass" ]; then
  182. mwpass=mutt-wizard-$mwaddr
  183. _mwgetpass
  184. fi
  185. unset mwidnum
  186. _mwaddrmwtype
  187. _mwgetprofiles
  188. mkdir -p "$mwmuttdir" "$mwaccmuttdir" "${mwmsmtprc%/*}" "${mwmbsyncrc%/*}"
  189. if [ ! -f "$mwmsmtprc" ]; then
  190. echo "$mwmsmtpheader" > "$mwmsmtprc"
  191. else
  192. sed -i "/account $mwacc/,/^\(\s*$\|account\)/d" "$mwmsmtprc"
  193. fi
  194. echo "$mwmsmtpprofile" >> "$mwmsmtprc"
  195. case "$mwservice" in
  196. protonmail.ch|protonmail.com|pm.me) protonfinger || return 1 ;;
  197. esac
  198. [ -f "$mwmbsyncrc" ] && sed -i "/IMAPStore $mwacc-remote$/,/# End profile/d" "$mwmbsyncrc"
  199. echo "$mwmbsyncprofile" >> "$mwmbsyncrc"
  200. #mwaccmuttrc
  201. mwaccmuttrc="$mwaccmuttdir/$(find "$mwaccmuttdir" -type f | grep -m 1 -o "[1-9]-$mwacc.mwonofftype.$mwtype.muttrc")"
  202. if [[ ! -f "$mwaccmuttrc" ]]; then
  203. # new mwidnum = first one missing
  204. _mwgetaccounts
  205. for mwx in $(seq 1 9); do echo "$mwaccounts" | grep "$mwx:" >/dev/null 2>&1 || { export mwidnum="$mwx"; break ;}; done
  206. mwaccmuttrc="$mwaccmuttdir/$mwidnum-$mwacc.mwonofftype.$mwtype.muttrc"
  207. else
  208. mwidnum=${mwaccmuttrc%%-*}
  209. mwidnum=${mwidnum##*/}
  210. fi
  211. echo "$mwmuttprofile" > "$mwaccmuttrc"
  212. [ ! -f "$mwmuttrc" ] && echo "# vim: filetype=neomuttrc" > "$mwmuttrc" && echo "muttrc created."
  213. ! grep "source $mwsharerc" "$mwmuttrc" >/dev/null && echo "source $mwsharerc # mw-autogenerated" >> "$mwmuttrc"
  214. if [ "$mwtype" = "offline" ]; then
  215. ! grep "^macro .* gM .*" "$mwmuttrc" >/dev/null && echo "macro index gM '<shell-escape>mailsync -Va<enter>' \"sync all mail\" # mw-autogenerated" >> "$mwmuttrc"
  216. fi
  217. ! grep "^source.*$mwaccmuttrc" "$mwmuttrc" >/dev/null && echo "source $mwaccmuttrc # mw-autogenerated" >> "$mwmuttrc"
  218. return 0
  219. }
  220. _mwprotonfinger() {
  221. printf "Getting Protonmail bridge fingerprint...\\n"
  222. mwfingerprint="$($msmtpbin --serverinfo --host=127.0.0.1 --port=1025 --tls --tls-certcheck=off)" || return 1
  223. sed -i "s/account $mwacc/&\ntls_trust_file\ntls_fingerprint $mwfingerprint/" "$mwmsmtprc"
  224. }
  225. _mwgetpass() {
  226. while : ; do pass rm -f "$mwpass" >/dev/null 2>&1
  227. pass insert "$mwpass" && break; done ;}
  228. _mwtryconnect() {
  229. if [ ! -d "$mwaccmaildir" ]; then
  230. mwaccmaildirWasThere="NO" # we need to remove again for "online"
  231. mkdir -p "$mwaccmaildir"
  232. fi
  233. if [ -z "$mailboxes" ]; then
  234. mailboxes="$($mbsyncbin -l $mwacc | sed 's/\//./')" >/dev/null 2>&1
  235. fi
  236. if [ -n "$mailboxes" ]; then
  237. mwspoolfile=$(echo "$mailboxes" | grep -i -m 1 inbox | sed -ne 's/.*/+\0/p')
  238. [ -z "$mwspoolfile" ] && return 1
  239. #make directories
  240. printf "\033[32mMailboxes detected.\033[0m\\n"
  241. echo "$mailboxes" | xargs -I {} mkdir -p "$mwaccmaildir/{}/"{cur,new,tmp}
  242. record=$(echo "$mailboxes" | grep -i -m 1 sent | sed -ne 's/.*/+\0/p')
  243. [ -z "$mwrecord" ] && mkdir -p "$mwaccmaildir/Sent/"{cur,new,tmp} && record="Sent"
  244. postponed=$(echo "$mailboxes" | grep -i -m 1 draft | sed -ne 's/.*/+\0/p')
  245. [ -z "$mwpostponed" ] && mkdir -p "$mwaccmaildir/Drafts/"{cur,new,tmp} && postponed="Drafts"
  246. trash=$(echo "$mailboxes" | grep -i -m 1 trash | sed -ne 's/.*/+\0/p')
  247. [ -z "$mwtrash" ] && mkdir -p "$mwaccmaildir/Trash/"{cur,new,tmp} && trash="Trash"
  248. return 0
  249. else
  250. printf "\033[31m\033[31mLog-on not successful.\033[0m\\nIt seems that either you inputted the wrong password or server settings, or there are other requirements for your account out of the control of mutt-wizard.\\n"
  251. return 1
  252. fi
  253. }
  254. _mwfinalize() { # new mwaccmuttrc
  255. mwboxes="$(find "$mwaccmaildir/" -name cur | sed "s,$mwaccmaildir/,,g;s,/cur,,")"
  256. if [[ "$mwboxes" =~ ^[[:space:]]*$ ]]; then
  257. printf "\033[31mNo local mailboxes have been detected for %s.\033[0m\\nThis means that mbsync has not been successfully run.\\nRun mbsync, and if it has an error, be sure to check your password and server settings manually if needbe.\\n" "$mwacc"
  258. return
  259. fi
  260. mwaccmutt="${email//[.@]/_}"
  261. muttsync=$(printf '<sync-mailbox><enter-command>source %s<enter><change-folder>!<enter>;<check-stats>' $mwaccmuttrc)
  262. cat >> "$mwaccmuttrc" <<EOF
  263. set spoolfile = "$mwspoolfile"
  264. set record = "$mwrecord"
  265. set postponed = "$mwpostponed"
  266. set trash = "$mwtrash"
  267. folder-hook \$folder '$muttsync'
  268. macro index,pager i$mwidnum '$muttsync' "switch to $mwacc"
  269. mailboxes =$mwaccmutt ===================== $(echo "$mwboxes" | sed -e "s/ //g;s/.*/\"=\0\"/g" | tr "\n" " ")
  270. EOF
  271. for mwabox in $mwboxes; do
  272. mwbox=${mwabox##*/}
  273. mwbox=${mwbox##*.}
  274. mwboxi=${mwbox::2}
  275. mwboxi=${mwboxi,,}
  276. cat >> $mwaccmuttrc <<EOF
  277. macro index,pager i$mwboxi "<change-folder>=$mwabox<enter>" "go to $mwbox"
  278. macro index,pager M$mwboxi "<save-message>=$mwabox<enter>" "move mail to $mwbox"
  279. macro index,pager C$mwboxi "<copy-message>=$mwabox<enter>" "copy mail to $mwbox"
  280. EOF
  281. done
  282. if [ "$mwtype" = "offline" ]; then
  283. _mwnotmuchauto
  284. printf "All done.\\n\033[33mYou can now run \`\033[32mmailsync [%s]\033[33m\` to sync your mail.\033[0m\\n" "$mwacc"
  285. else
  286. mkdir -p "$mwacccachedir"
  287. sed -i "/IMAPStore $mwacc-remote$/,/# End profile/d" "$mwmbsyncrc"
  288. [ "$mwaccmaildirWasThere" = "NO" ] && rm -rf "$mwaccmaildir"
  289. fi
  290. return 0
  291. }
  292. _mwconfirm() {
  293. printf "[y/N]: Do you want to %s?\\n\t" "$@" && read -r mwinput && ! echo "$mwinput" | grep -i "^y$\|^yes$" >/dev/null && printf "That doesn't seem like a yes to me.\\n\\n" && return 1
  294. return 0 ;
  295. }
  296. _mwpick() {
  297. printf "Select an accounts to %s:\\n" "$1"
  298. _mwlist
  299. [ -z "$mwpick" ] && read -r mwpick
  300. mwidnum="$mwpick"
  301. [ -z "$mwidnum" ] && return 1
  302. mwaddr="$(echo "$mwaccounts" | grep "$mwidnum:" | sed "s/\.mwonofftype\./ /" | awk '{print $2}')"
  303. mwtype="$(echo "$mwaccounts" | grep "$mwidnum:" | sed "s/\.mwonofftype\./ /" | awk '{print $3}')"
  304. _mwaddrmwtype
  305. [ -z "$mwacc" ] && printf "Invalid response." && return 1
  306. return 0 ;
  307. }
  308. _mwdelete() {
  309. rm -f "$mwaccmuttrc"
  310. sed -i "/$mwaccmuttrc/d" "$mwmuttrc"
  311. if [ "$mwtype" = "offline" ]; then
  312. sed -i "/IMAPStore $mwacc-remote$/,/# End profile/d" "$mwmbsyncrc"
  313. sed -i "/account $mwacc/,/^\(\s*$\|account\)/d" "$mwmsmtprc"
  314. else
  315. rm -rf "$mwacccachedir"
  316. fi
  317. }
  318. _mwcron() {
  319. ! pgrep cron >/dev/null && echo "No cron manager running. Install/enable one and then select this option again." && return 1
  320. if crontab -l | grep mailsync >/dev/null; then
  321. echo "Active mail sync cronjob detected. Do you want to remove it?"
  322. printf "\033[36m\t"
  323. [ -z "$mwcronremove" ] && read -r mwcronremove
  324. printf "\033[0m"
  325. echo "$mwcronremove" | grep -i "^y\(es\)*$" >/dev/null && crontab -l | sed '/mailsync/d' | crontab - >/dev/null && echo "Mail sync turned off."
  326. else
  327. echo "How many minutes between each mail sync?"
  328. printf "\033[36m\t"
  329. [ -z $mwcronminutes ] && read -r mwcronminutes
  330. printf "\033[0m"
  331. while ! echo "$mwcronminutes" | grep "^[1-9]\+$" >/dev/null; do
  332. printf "That doesn't look like a number. How many minutes between each mail sync?\\n\033[36m\t"
  333. read -r mwcronminutes
  334. printf "\033[0m"
  335. done
  336. (crontab -l; echo "*/$mwcronminutes * * * * export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus; export DISPLAY=:0; $(type mailsync | cut -d' ' -f3)") | crontab - &&
  337. echo "Cronjob added. Mail will sync every $mwcronminutes minutes. Be sure you have your cron manager running."
  338. fi
  339. }
  340. _mwasktype() {
  341. if [ -z "$mwtype" ]; then
  342. while : ; do
  343. printf "[yes/no]: Local mail via mbsync? No: Mutt remotes (slower)\\n\t"
  344. read -r mwoffline
  345. case "$mwoffline" in
  346. [Yy][Ee][Ss]) mwtype="offline" && break ;;
  347. [Nn][Oo]) mwtype="online" && break ;;
  348. *) echo "Write out either yes or no completely. Try again or press ctrl-c to quit." ;;
  349. esac
  350. done
  351. fi
  352. }
  353. _mwpurge() {
  354. _mwconfirm "delete all account data" || exit
  355. rm -rf "$mwaccmuttdir" "${mwmsmtprc%/*}" "${mwmbsyncrc%/*}" "$mwcachedir"
  356. sed -i "/\# mw-autogenerated/d" "$mwmuttrc"
  357. pgrep cron >/dev/null && crontab -l | sed '/mailsync/d' | crontab - >/dev/null
  358. echo "All configs and account settings have been purged."
  359. }
  360. _mwnotmuchauto() {
  361. [ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config"
  362. [ -f "$NOTMUCH_CONFIG" ] && return 0
  363. mwnmbasic="[database]
  364. path=$mwmaildir
  365. [user]
  366. name=$mwname
  367. primary_email=$mwaddr
  368. [new]
  369. tags=unread;inbox;
  370. ignore=
  371. [search]
  372. exclude_tags=deleted;spam;
  373. [maildir]
  374. synchronize_flags=true
  375. [crypto]
  376. gpg_path=$GPG"
  377. mkdir -p "${NOTMUCH_CONFIG%/*}"
  378. echo "$mwnmbasic" > "$NOTMUCH_CONFIG"
  379. }
  380. trap 'echo -e "\033[0m\n"; exit' STOP INT ABRT KILL
  381. if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
  382. case "$1" in
  383. ls) _mwlist ;;
  384. add) _mwadd ;;
  385. pass) _mwpick "change the password of" && _mwgetpass ;;
  386. delete) _mwpick delete && _mwconfirm "delete the \`$mwacc\` profile" && _mwdelete ;;
  387. purge) _mwpurge ;;
  388. cron) _mwcron ;;
  389. *) cat << EOF
  390. mw: mutt-wizard, auto-configure email accounts for mutt
  391. including downloadable mail with \`isync\`.
  392. Allowed options:
  393. add Add and autoconfigure an email address (9 max.)
  394. ls List configured accounts
  395. delete Pick an account to delete
  396. purge Delete all accounts and settings
  397. cron Enable or disable an autosync via cronjob
  398. all else Print this message
  399. NOTE: Once at least one account is added, you can run
  400. \`mailsync -a\` to begin downloading mail.
  401. EOF
  402. esac
  403. fi