enough_mail icon indicating copy to clipboard operation
enough_mail copied to clipboard

No mailbox with flag MailboxFlag.sent found

Open marcoedomingos opened this issue 4 years ago • 6 comments

I can't access the Sent folder with the library, but I can on any other client email app, when I try to send an email with this library, I receive this response:

Unhandled Exception: MailException: No mailbox with flag MailboxFlag.sent found in ["Lixo Eletrônico" exists: 0, highestModeSequence: null, "Itens Excluídos" exists: 0, highestModeSequence: null, "Itens Enviados" exists: 0, highestModeSequence: null, "Trash" exists: 0, highestModeSequence: null, "INBOX.spam" exists: 0, highestModeSequence: null, "Sent" exists: 0, highestModeSequence: null, "Drafts" exists: 0, highestModeSequence: null, "INBOX" exists: 4, highestModeSequence: 16].

marcoedomingos avatar Sep 17 '21 18:09 marcoedomingos

Thanks for the report, what mail service are you using? Also, would it be possible to test this again while depending on the git version of enough_mail? This should produce more output. In your project, use this dependency:

dependencies:
  enough_mail: 
    git:
      url: https://github.com/Enough-Software/enough_mail.git

I assume that you are using MailClient.sendMessage(...) which triggers this problem, is that correct?

robert-virkus avatar Sep 17 '21 19:09 robert-virkus

I am also facing a similar issue. There are no flags present in mailboxes list neither sent nor any other (draft,archive,junk etc..)

kunalmanocha98 avatar Oct 01 '21 10:10 kunalmanocha98

Thanks for the report, what mail service are you using? Also, would it be possible to test this again while depending on the git version of enough_mail? This should produce more output. In your project, use this dependency:

dependencies:
  enough_mail: 
    git:
      url: https://github.com/Enough-Software/enough_mail.git

I assume that you are using MailClient.sendMessage(...) which triggers this problem, is that correct?

But this is not compatible with enough_flutter and enough_editor

kunalmanocha98 avatar Oct 01 '21 10:10 kunalmanocha98

I assume this is because the mail service in question does not support mailbox flags, rfc 6154. Can you confirm that this problem occurs when sending a message?

In regards to the dependencies, you can also alter the dependencies of enough_mail_flutter and enough_mail_html to target to the respective git repositories.

dependencies:
  enough_mail: 
    git:
      url: https://github.com/Enough-Software/enough_mail.git
  enough_mail_flutter: 
    git:
      url: https://github.com/Enough-Software/enough_mail_flutter.git
  enough_mail_html: 
    git:
      url: https://github.com/Enough-Software/enough_mail_html.git

robert-virkus avatar Oct 01 '21 11:10 robert-virkus

Yes, I am encountering the mailbox flags issues. this problem occurs when save a draft and also while appending the message to sent when sending a message.

kunalmanocha98 avatar Oct 04 '21 04:10 kunalmanocha98

When the IMAP service does not support mailbox flags, it pretty much boils down to guessing, so implementations can now either guess or ask the user to specify the respective mailboxses.

I just pushed a change to MailClient so that you can specify a target mailbox when sending a message or saving a draft.

Note that you can also set the appendToSent parameter to false in sendMessage:

Future<void> sendMessage(
    MimeMessage message, {
    MailAddress? from,
    bool appendToSent = true,
    Mailbox? sentMailbox,
    bool use8BitEncoding = false,
    List<MailAddress>? recipients,
  })

In saveDraft you can now also specify a mailbox:

  Future<UidResponseCode?> saveDraftMessage(MimeMessage message,
      {Mailbox? draftsMailbox})

Both changes are available on head.

robert-virkus avatar Oct 04 '21 20:10 robert-virkus