Imap用于删除带有消息ID的邮件的命令 [英] Imap Command to delete a mail message with a message ID
问题描述
我需要帮助才能根据c#中的某些条件删除邮件。
i在互联网搜索中找到类似下面的东西 -
imap.Command(copy+ ids [i] .ToString()+[Gmail] / + action_flag);
这似乎是将它复制到某个文件夹,而不是删除。
有没有办法使用消息ID删除消息。我的代码是 -
MessageCollection idsDel = inbox.SearchParse(SEEN BEFORE+ dtDeletebeforeDate +FROM GOURAV);
int [] ids = inbox.Search(SEEN BEFORE+ dtDeletebeforeDate +FROM GOURAV);
if (idsDel.Count > 0 )
{
消息msg = null ;
for ( var i = 0 ; i < idsDel.Count; i ++)
{
msg = inbox.Fetch.MessageObject(ids [i ]);
if (msg.MessageId == idsDel [i] .MessageId)
{
imap.Command(
break ;
}
}
}
有没有办法直接在命令中使用某些东西来删除邮件?
你必须存储消息,并且呼叫消除。
商店命令如下:
_CommandText = string .Format( {0} STORE {1} +标记(\\DELETED)\\\\ n,CommandPrefix,sequenceNumber);
,其中CommandPrefix是数字调用和顺序eNumber邮件的数量
expunge命令如下所示:
_ CommandText = string .Format( {0} EXPUNGE\r\ n,CommandPrefix) ;
Hi,
I need help to delete a mail message based on some condition in c#.
i found something like below on some search on internet-
imap.Command("copy " + ids[i].ToString() + " [Gmail]/" + action_flag);
this seems to be copying it to some folder, not delete.
Is there any way to delete the message using message id. my code is-
MessageCollection idsDel = inbox.SearchParse("SEEN BEFORE " + dtDeletebeforeDate + " FROM GOURAV");
int[] ids = inbox.Search("SEEN BEFORE " + dtDeletebeforeDate + " FROM GOURAV");
if (idsDel.Count > 0)
{
Message msg = null;
for (var i = 0; i < idsDel.Count; i++)
{
msg = inbox.Fetch.MessageObject(ids[i]);
if (msg.MessageId == idsDel[i].MessageId)
{
imap.Command(
break;
}
}
}
is there any way to use something in command directly to delete the message?
You have to store the message, and the call expunge.
The store command looks like:
_CommandText = string.Format("{0} STORE {1} +FLAGS (\\DELETED)\r\n", CommandPrefix, sequenceNumber);
with CommandPrefix being the number of the call, and sequenceNumber the number of the mail message
The expunge command looks like:
_CommandText = string.Format("{0} EXPUNGE\r\n", CommandPrefix);
这篇关于Imap用于删除带有消息ID的邮件的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!