Skip to content

Commit afb6846

Browse files
authored
Merge pull request #1035 from mojtabavahidinasab/master
Added --proxy to curl
2 parents e322599 + ade5d0c commit afb6846

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎bin/mw‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ getboxes() {
221221
if [ -n "${force+x}" ]; then
222222
mailboxes="$(printf "INBOX\\nDrafts\\nJunk\\nTrash\\nSent\\nArchive")"
223223
else
224-
info="$(curl --location-trusted -s -m 5 --user "$login:$(pass "$passprefix$fulladdr")" --url "${protocol:-imaps}://$imap:${iport:-993}")"
224+
info="$(curl --proxy "$proxy" --location-trusted -s -m 5 --user "$login:$(pass "$passprefix$fulladdr")" --url "${protocol:-imaps}://$imap:${iport:-993}")"
225225
[ -z "$info" ] && errorexit
226226
mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d '\r')"
227227
fi
@@ -301,6 +301,7 @@ Options allowed with -a:
301301
-X Delete an account's local email too when deleting.
302302
-o Configure address, but keep mail online.
303303
-f Assume typical English mailboxes without attempting log-on.
304+
-R Use a proxy server for curl (useful for bypassing network restrictions)
304305
305306
NOTE: Once at least one account is added, you can run
306307
\`mbsync -a\` to begin downloading mail.
@@ -333,9 +334,10 @@ reorder() {
333334
' "$tempfile" >>"$muttrc"
334335
}
335336

336-
while getopts "rfpXlhodTYD:y:i:I:s:S:u:a:n:P:x:m:t:" o; do case "${o}" in
337+
while getopts "rfpXlhodTYD:y:i:I:s:S:u:a:n:P:x:m:t:R:" o; do case "${o}" in
337338
l) setact list ;;
338339
r) setact reorder ;;
340+
R) proxy="$OPTARG" ;;
339341
d) setact delete ;;
340342
D)
341343
setact delete

‎mw.1‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ Account password. You will be prompted for the password interactively if this op
7373
.TP
7474
.B -P
7575
Pass Prefix. The password will be stored using pass at <passprefix><email>
76+
.TP
77+
.B -R
78+
Use a proxy server for curl (useful for bypassing network restrictions)
7679
.SH OTHER OPTIONS
7780
.TP
7881
.B -f

0 commit comments

Comments
 (0)