Repository: thundernest/k-9
Issue: "To" field does not convert typed email addresses to tokens on send

### Expected behavior

Autocomplete address field "To" should convert typed email addresses to tokens when clicking send
### Actual behavior

It does not, shows "Recipient field contains incomplete input!"
### Steps to reproduce
1. compose mail
2. write body subject and in the last step write email address into "To" field without selecting an email address from the dropdown
3. click send
### Environment

K-9 Mail version: 5.110

Android version: 6

Account type (IMAP, POP3, WebDAV/Exchange): IMAP


Changed files:
k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java, k9mail/src/main/java/com/fsck/k9/view/RecipientSelectView.java, k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientMvpView.java

diff --git a/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientMvpView.java b/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientMvpView.java
index a8889a388..cb04bb62e 100644
--- a/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientMvpView.java
+++ b/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientMvpView.java
@@ -258,6 +258,18 @@ public class RecipientMvpView implements OnFocusChangeListener, OnClickListener
         return bccView.hasUncompletedText();
     }
 
+    public boolean recipientToTryPerformCompletion() {
+        return toView.tryPerformCompletion();
+    }
+
+    public boolean recipientCcTryPerformCompletion() {
+        return ccView.tryPerformCompletion();
+    }
+
+    public boolean recipientBccTryPerformCompletion() {
+        return bccView.tryPerformCompletion();
+    }
+
     public void showToUncompletedError() {
         toView.setError(toView.getContext().getString(R.string.compose_error_incomplete_recipient));
     }
diff --git a/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java b/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java
index a6610e9b9..f16b788e7 100644
--- a/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java
+++ b/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java
@@ -116,6 +116,13 @@ public class RecipientPresenter implements PermissionPingCallback {
     }
 
     public boolean checkRecipientsOkForSending() {
+        boolean performedAnyCompletion = recipientMvpView.recipientToTryPerformCompletion() ||
+                recipientMvpView.recipientCcTryPerformCompletion() ||
+                recipientMvpView.recipientBccTryPerformCompletion();
+        if (performedAnyCompletion) {
+            return true;
+        }
+
         if (recipientMvpView.recipientToHasUncompletedText()) {
             recipientMvpView.showToUncompletedError();
             return true;
diff --git a/k9mail/src/main/java/com/fsck/k9/view/RecipientSelectView.java b/k9mail/src/main/java/com/fsck/k9/view/RecipientSelectView.java
index e7dc78918..3c5dee446 100644
--- a/k9mail/src/main/java/com/fsck/k9/view/RecipientSelectView.java
+++ b/k9mail/src/main/java/com/fsck/k9/view/RecipientSelectView.java
@@ -364,6 +364,21 @@ public class RecipientSelectView extends TokenCompleteTextView<Recipient> implem
         }
     }
 
+    public boolean tryPerformCompletion() {
+        if (!hasUncompletedText()) {
+            return false;
+        }
+        int previousNumRecipients = getTokenCount();
+        performCompletion();
+        int numRecipients = getTokenCount();
+
+        return previousNumRecipients != numRecipients;
+    }
+
+    private int getTokenCount() {
+        return getObjects().size();
+    }
+
     public boolean hasUncompletedText() {
         String currentCompletionText = currentCompletionText();
         return !TextUtils.isEmpty(currentCompletionText) && !isPlaceholderText(currentCompletionText);