bash脚本中的IMAP UID MOVE-如何正确执行?

时间:2018-12-05 16:33:49

标签: bash imap dovecot

我有剧本:

#!/bin/bash
mailsrv='mailserver.uk';
login='login@domain.uk';
pass='veryhardpass';
flw='/tmp/imap_msg';

id=1;

while true;
do
        echo "Message ${id}" 1>/dev/null
        curl -s --insecure --url "imaps://$mailsrv/INBOX/;UID=${id}" --user "$login:$pass" -o "$flw" || exit

        if [ -e $flw ]
        then
                cat "$flw" | /home/user/script.php;
                rm $flw;
                imapcmd="UID MOVE $id \\Trash; EXPUNGE";
                curl --verbose --insecure --url "imaps://$mailsrv/INBOX/" --user "$login:$pass" -X "$imapcmd" || exit
        fi

        id=`expr $id + 1`
done

此脚本给我一个错误:

< A002 OK Logged in
> A003 SELECT INBOX
< * FLAGS (\Answered \Flagged \Deleted \Seen \Draft NonJunk)
< * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft NonJunk \*)] Flags permitted.
< * 1 EXISTS
< * 0 RECENT
< * OK [UIDVALIDITY 1515605811] UIDs valid
< * OK [UIDNEXT 1027] Predicted next UID
< A003 OK [READ-WRITE] Select completed (0.000 + 0.000 secs).
> A004 UID MOVE 1 \Trash;
< A004 NO [TRYCREATE] Mailbox doesn't exist: \Trash; (0.000 + 0.000 secs).
> A005 LOGOUT
< * BYE Logging out
< A005 OK Logout completed (0.000 + 0.000 secs).

我坚持了几天。

我尝试过: -IMAP命令中的许多组合, -谷歌搜索和谷歌搜索, -尝试找到带有dovecot的UID MOVE的好例子,

0 个答案:

没有答案