我已经使用imaplib和python一段时间了,我一直在重写我的一些代码。我最近遇到了一个问题,当我访问电子邮件的标题时,邮件被设置为读取。
我在imaplib中使用此 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace _06.Replace_a_Tag
{
class Program
{
static void Main(string[] args)
{
string text = Console.ReadLine();
while (text != "end")
{
string pattern = @"<a.*?href.*?=(.*)>(.*?)<\/a>";
// is used to take only 2 groups :
// first group (or group one) is used for the domain name
// for example : "https://stackoverflow.com"
// and the second is for if you want to enter some text
// (or no text)
// for example : This is some text
string replace = @"[URL href=$1]$2[/URL]";
// we use $ char and a number (like placeholders)
// for example : $1 means take whatever you find from group 1
// and : $2 means take whatever you find from group 2
string replaced = Regex.Replace(text, pattern , replace);
// In a specific input string (text), replaces all strings
// that match a specified regular expression (pattern ) with
// a specified replacement string (replace)
Console.WriteLine(replaced);
text = Console.ReadLine();
}
}
}
}
// input : <ul><li><ahref=""></a></li></ul>
// output: <ul><li>[URL href=""][/URL]</li></ul>
查询。
所以,我的问题归结为此。为什么消息被设置为已读?如何对此进行反转,以便它们不会更改这些消息的读取标志?
答案 0 :(得分:0)
如果您获取任何BODY
部分,它会将邮件标记为已读。请改用BODY.PEEK
。
c.fetch('(UID BODY.PEEK[HEADER])')