首页 > 解决方案 > 如何使用 fetchmail / procmail 删除 IMAP 邮件

问题描述

我使用fetchmailwithimap协议从邮件服务器上传电子邮件,并将它们通过管道传输到procmail. 我使用以下命令执行此操作:

fetchmail -f /home/$USER/.fetchmailrc --ssl -t 100 -d 240 -s -m "/usr/bin/procmail /home/$USER/.procmailrc " 

.fetchmailrc如下:

poll imap.my_email_server.com protocol IMAP
user "user@email_server.com" with password "myPassword" is "user@email_server.com" here keep

.procmailrc 如下:

:0: 
* ^Subject: someSubject
{
  :0 c
  |  $BIN/parse_email
  :0 c
  $HOME/posnav
  :0 
  /dev/null
}

一切正常,但我怎样才能制作最后一个命令(在这里我将电子邮件推送到 /dev/null 只是为了显示目的)删除服务器上我从中获取电子邮件的电子邮件?

标签: imapprocmailfetchmail

解决方案


If you want to delete the mail on the server, you have to tell fetchmail to do that.

But, you explicitly told fetchmail to keep the message on the server by including the keyword "keep" in the run control file.

Change it to "no keep":

poll imap.my_email_server.com protocol IMAP
user "user@email_server.com" with password "myPassword" is "user@email_server.com" here no keep

推荐阅读