Skip to content

Commit

Permalink
fixing imap
Browse files Browse the repository at this point in the history
  • Loading branch information
ozzi- committed Mar 28, 2019
1 parent 540c6c5 commit 23ed033
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions check_mailbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,20 @@ credentialarg=""
if [ ! -z "$credential" ] ; then
credentialarg=' --user "'$credential'"'
fi

commandarg='"LIST"'
if [ $imap -eq 1 ] ; then
commandarg='"EXAMINE '$mailbox'"'
fi

#The actual curl
start=$(echo $(($(date +%s%N)/1000000)))

if [ $imap -eq 0 ]; then
body=$(eval curl --url "$fqhost" -X "LIST" $credentialarg -s --max-time $maxwait $insecurearg $verbosearg)
body=$(eval curl --url "$fqhost" -X $commandarg $credentialarg -s --max-time $maxwait $insecurearg $verbosearg)
status=$?
body=$(echo "$body" | tail -1 | cut -d " " -f1)
else
body=$(eval curl --url "$fqhost" -X "EXAMINE $mailbox" $credentialarg -s --max-time $maxwait $insecurearg $verbosearg)
body=$(eval curl --url "$fqhost" -X $commandarg $credentialarg -s --max-time $maxwait $insecurearg $verbosearg)
status=$?
body=$(echo "$body" | head -1 | cut -d " " -f2)
fi
Expand Down

0 comments on commit 23ed033

Please sign in to comment.