MailKit: Get this error when I append the message to the sent folder using imap client
Hi, I get the below error when I append the message to the sent folder. the same code has worked before. But for some reason, it stopped working. Error is below: The IMAP server replied to the ‘APPEND’ command with a ‘BAD’ response: Additional arguments found after last expected argument
My code is below:
using (var imapClient = new ImapClient(new NullProtocolLogger()))
{
var imapSecurity = emailConfiguration.IMAPSecurityConfiguration;
var imapSecurityEnum = imapSecurity.Trim().ToLower().Contains("ssl")
? SecureSocketOptions.SslOnConnect
: SecureSocketOptions.StartTls;
imapClient.Connect(emailConfiguration.IMAPServer, emailConfiguration.IMAPPort,
imapSecurityEnum);
imapClient.AuthenticationMechanisms.Remove("XOAUTH2");
imapClient.Authenticate(emailConfiguration.UserName,
emailConfiguration.Password);
var personalFolders = imapClient.GetFolders(imapClient.PersonalNamespaces[0]);
var sentFolder = personalFolders.FirstOrDefault(r => r.Name.ToLower().Contains("sent"));
if (sentFolder != null)
{
sentFolder.Open(FolderAccess.ReadWrite);
sentFolder.Append(message);
sentFolder.Close();
}
}
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 27 (14 by maintainers)
Links to this issue
Commits related to this issue
- Added FormatOptions.EnsureNewLine property Partial fix for https://github.com/jstedfast/MailKit/issues/251 — committed to jstedfast/MimeKit by jstedfast 6 years ago
- Updated SmtpClient and ImapFolder.Append to use FormatOptions.EnsureNewLine Fixes issue #251 — committed to jstedfast/MailKit by jstedfast 6 years ago
I probably won’t get a chance to make another release for another 2 weeks or so, but the above commits should fix the issue.