From be426dc41377a60689f46af9c4fefbe936950d1f Mon Sep 17 00:00:00 2001 From: Ioan Moldovan Date: Tue, 22 Oct 2024 07:57:16 -0500 Subject: [PATCH] fix: sender --- FlowCrypt/Controllers/Compose/ComposeViewController.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/FlowCrypt/Controllers/Compose/ComposeViewController.swift b/FlowCrypt/Controllers/Compose/ComposeViewController.swift index fd0b93bbb..7a3eef765 100644 --- a/FlowCrypt/Controllers/Compose/ComposeViewController.swift +++ b/FlowCrypt/Controllers/Compose/ComposeViewController.swift @@ -162,8 +162,14 @@ final class ComposeViewController: TableNodeViewController { .fetchList(isForceReload: false, for: appContext.user) .filter { $0.verificationStatus == .accepted || $0.isDefault } + // Sender might be user's alias email, so we need to check if the sender is user's email address + // and set sender as email alias if applicable + var sender = appContext.user.email + if let inputSender = input.sender, sendAsList.contains(where: { $0.sendAsEmail == inputSender }) { + sender = inputSender + } self.contextToSend = ComposeMessageContext( - sender: input.sender ?? appContext.user.email, + sender: sender, subject: input.subject, attachments: input.attachments )