Closed faisalbwn closed 1 year ago
This usage will most likely change, but let me know if this works for you in the latest RC:
private async Task<MimeMessage?> ReceiveMimeMessageAsync(UniqueId uniqueId, CancellationToken cancellationToken = default)
{
var uids = new UniqueId[] { uniqueId };
var mimeMessages = await _imapReceiver.ReadMail.GetMimeMessageEnvelopeBodyAsync(uids, cancellationToken);
return mimeMessages.FirstOrDefault();
}
Please test this in the latest RC (same usage as for IMessageSummary):
var reader = _imapReceiver.ReadMail.Range(start, end, continuous: true);
IList<MimeMessage> mimeMessages;
do
{
mimeMessages = await reader.GetMimeMessagesEnvelopeBodyAsync(cancellationToken);
foreach (var mimeMessage in mimeMessages)
{
await ProcessMessages(mimeMessage, cancellationToken);
}
}
while (mimeMessages.Count > 0);
Thanks Daniel for support. I tested the new method, it is getting email without attachments. But it is not fetching TextBody in some cases and in some cases it is not fetching the HtmlBody.
Most emails don't have a TextBody, and some don't have an HtmlBody.
You are right Daniel. But there is difference in both methods, for the same email _mailFolderReader.GetMimeMessageAsync is returning but _mailFolderReader.GetMimeMessageEnvelopeBodyAsync is not.
Thanks for checking that, I won't have time to look now but I'll let you know when I have.
Sure Daniel, Thanks.
I've simplified GetMimeMessageEnvelopeBodyAsync to only return HTML if it exists, otherwise text. I found two other issues with it too, so even though I didn't have time to test it this morning the latest RC should work for you now.
Thanks Daniel, i will test it thoroughly and share the results.
Let me know if you find anything else 🙂
Hi Daniel,
I am downloading the single mime message with the following code:
// Fetch email message against presisted uid
MimeMessage mimeMessage = await _mailFolderReader.GetMimeMessageAsync(new UniqueId(uniqueId), cancellationToken);
Can you please guide how can I download mime message without attachments. I want to download attachment later on demand.