listBox1.Items.Add(from + ": " + x.Subject); 是什么没有返回所需的结果,它添加“:”而不是“FirstNameLastName:主题标题”
https://imapx.codeplex.com/wikipage?title=Sample%20code%20for%20get%20messages%20from%20your%20inbox
List<Task> m = new List<Task>();
private async void cmdLogin_Click(object sender, EventArgs e)
{
bool result = imapMail.Connection();
if (result)
{
result = imapMail.LogIn(email, password);
if (result)
{
var messes = imapMail.Folders[inbox].Messages;
foreach (var x in messes)
{
string from = "";
foreach (var addresses in x.From)
{
from = addresses.DisplayName;
}
listBox1.Items.Add(from + ": " + x.Subject);
}
foreach (ImapX.Message msgs in imapMail.Folders[inbox].Messages)
{
m.Add(new Task(new Action(() => msgs.Process())));
}
await Task.WhenAll(m);
}
else { this.Text = "failed login"; }
}
else { this.Text = "Failed connection"; }
}
}
除了冒号之外,这没有返回任何内容,它应该返回一个显示名称:消息主题