Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microsoft E-Mail not allowed to send as reply+douglas@fakedomain.com.br #9523

Open
drauber opened this issue May 22, 2024 · 16 comments
Open
Labels
Bug 📮 channel/microsoft-email Issues related to Microsoft email channel need-more-info This issue does not have enough information to start working on it. product Issues related to the product

Comments

@drauber
Copy link

drauber commented May 22, 2024

Describe the bug

We have a self hosted CW, today my boss tell me to setup CW to listen from E-Mail from Office365.
I have created the application and setup it following https://www.chatwoot.com/docs/self-hosted/configuration/features/email-channel/azure-app-setup/ i setup my account as channel, and i have received my emails with success.
But, when i try to reply a email, and going to SuperAdmin, i can see a dead task whit this:

Net::SMTPFatalError: 554 5.2.252 SendAsDenied; douglas@fakedomain.com.br not allowed to send as reply+douglas@fakedomain.com.br; STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenie..

How i can solve this?

To Reproduce

In default clone of CW, setup MSOauth
Set Azure variables in the .env
Create an inbox with Office365 email.
And try to send email from CW to Any contact using the created inbox.

Expected behavior

No response

Environment

Linux VM

Cloud Provider

None

Platform

Browser

Operating system

Ubuntu 22.04

Browser and version

Chrome

Docker (if applicable)

No response

Additional context

No response

@drauber drauber added the Bug label May 22, 2024
Copy link

linear bot commented May 22, 2024

@mattos123
Copy link

hello, i'm having the same issue.
same context, i can receive the emails, but i can't send them, i get the same error

@pranavrajs
Copy link
Member

@drauber @mattos123 This seems like a configuration issue, reply+ emails are generated only for the forwarded emails category. If you use Microsoft email and have used the Oauth Signin flow, this shouldn't be happening. Is there any additional information which you can provide here?

@pranavrajs pranavrajs added need-more-info This issue does not have enough information to start working on it. 📮 channel/microsoft-email Issues related to Microsoft email channel labels May 24, 2024
@mattos123
Copy link

i've configured the .env with smtp credentials,
created an inbox using the same email i use as smtp.

when i configure the inbox using microsoft azure app, i sign in as follow on the picture,
githubissue

@drauber
Copy link
Author

drauber commented May 24, 2024

I haven't configure SMTP in .env, I only set the azure app id and azure secret token, i want to use only the IMAP of Office365.
I don't knwo what other information you need to check if this problem? What else can be useful?

Thansk

@pranavrajs
Copy link
Member

@drauber

I haven't configure SMTP in .env, I only set the azure app id and azure secret token, i want to use only the IMAP of Office365. I don't knwo what other information you need to check if this problem? What else can be useful?

This is fine, you don't need to configure SMTP.

Can you please post the full logs not just the lines which you have added, but the logs from the time when you sent the message and the error is thrown?

@pranavrajs
Copy link
Member

@mattos123

i've configured the .env with smtp credentials, created an inbox using the same email i use as smtp.

You shouldn't be configuring the SMTP in env with your Microsoft email. This config is used to send account notification emails which would not work on a personal / work email with Microsoft.

@mattos123
Copy link

guys, i found the solution....
(PTBR)
Acesse o Centro de Administração do Microsoft 365:

Vá para admin.microsoft.com.
Navegue até a Central de Administração do Exchange:

No menu de navegação, vá para Admin centers e selecione Exchange.
Configurar uma Regra de Fluxo de Email:

No painel de navegação à esquerda, clique em Mail flow.
Vá para a aba Rules.
Clique em + para adicionar uma nova regra e selecione Create a new rule.
Definir a Regra:

Dê um nome à regra, por exemplo, "Allow Send As for Alias".
Em Apply this rule if... (Aplique esta regra se...), selecione The sender is... e escolha suporte@DOMAIN.br.
Em Do the following... (Faça o seguinte...), selecione Modify the message properties... e depois Set a message header.
Em Set the message header, defina:
Message header: Microsoft.Exchange.Data.HeaderName
Value: reply+suporte@DOMAIN.br.

(ENUS)

860 / 5.000
Access the Microsoft 365 Admin Center:

Go to admin.microsoft.com.
Navigate to the Exchange Admin Center:

In the navigation menu, go to Admin centers and select Exchange.
Configure a Mail Flow Rule:

In the left navigation pane, click Mail flow.
Go to the Rules tab.
Click + to add a new rule and select Create a new rule.
Define the Rule:

Give the rule a name, for example, "Allow Send As for Alias".
In Apply this rule if..., select The sender is... and choose support@DOMAIN.br.
Under Do the following..., select Modify the message properties... and then Set a message header.
In Set the message header, define:
Message header: Microsoft.Exchange.Data.HeaderName
Value: reply+suporte@DOMAIN.br.

IMPORTANT!!!
must create a rule for each email you want to use as an inbox on chatwoot, example,
you have 1 email on your .env , this is email is called "suporte@domain"
on the inbox, you created, you have the email "mattos@domain",
on the other inbox, you created, you have the email "giovani@domain",
you have to create a rule on azure portal, for mattos, and another for giovani

@drauber
Copy link
Author

drauber commented May 24, 2024

@drauber

I haven't configure SMTP in .env, I only set the azure app id and azure secret token, i want to use only the IMAP of Office365. I don't knwo what other information you need to check if this problem? What else can be useful?

This is fine, you don't need to configure SMTP.

Can you please post the full logs not just the lines which you have added, but the logs from the time when you sent the message and the error is thrown?

I can't reproduce the error now, yesterday i update the production env with this changed code.. and the error is not present now. But i'm try to setup a test environment with other Azure Application to try discover the root problem.
image

@mattos123
Copy link

@mattos123

i've configured the .env with smtp credentials, created an inbox using the same email i use as smtp.

You shouldn't be configuring the SMTP in env with your Microsoft email. This config is used to send account notification emails which would not work on a personal / work email with Microsoft.

i understand, but , i configured the account "suporte" with smtp capabilities, and also use as a normal mailbox, thats the reason i use the same account with smtp on .env, and as an inbox on the web aplication

@mattos123
Copy link

@drauber

I haven't configure SMTP in .env, I only set the azure app id and azure secret token, i want to use only the IMAP of Office365. I don't knwo what other information you need to check if this problem? What else can be useful?

This is fine, you don't need to configure SMTP.
Can you please post the full logs not just the lines which you have added, but the logs from the time when you sent the message and the error is thrown?

I can't reproduce the error now, yesterday i update the production env with this changed code.. and the error is not present now. But i'm try to setup a test environment with other Azure Application to try discover the root problem. image
(ptbr)
consegui resolver o erro do send as reply+ denied, com o caminho que orientei acima, acredito que removendo a logica do reply+ do codigo fonte do chatwoot quebre a continuidade do email
(enus)
I managed to resolve the send as reply+ denied error, with the path I suggested above, I believe that removing the reply+ logic from the chatwoot source code breaks the continuity of the email

@drauber
Copy link
Author

drauber commented May 24, 2024

Não quebra não @mattos123
Fiz isso ontem e já está em produção👍

Obrigado pela sugestão.

@mattos123
Copy link

@drauber

I haven't configure SMTP in .env, I only set the azure app id and azure secret token, i want to use only the IMAP of Office365. I don't knwo what other information you need to check if this problem? What else can be useful?

This is fine, you don't need to configure SMTP.
Can you please post the full logs not just the lines which you have added, but the logs from the time when you sent the message and the error is thrown?

I can't reproduce the error now, yesterday i update the production env with this changed code.. and the error is not present now. But i'm try to setup a test environment with other Azure Application to try discover the root problem. image

changed the source code the same way as you did, an it worked, thanks for the tip

@laianeramos
Copy link

Oi! O que vc alterou no production env? Vc apagou essa parte que está selecionada na imagem?

@drauber

I haven't configure SMTP in .env, I only set the azure app id and azure secret token, i want to use only the IMAP of Office365. I don't knwo what other information you need to check if this problem? What else can be useful?

This is fine, you don't need to configure SMTP.
Can you please post the full logs not just the lines which you have added, but the logs from the time when you sent the message and the error is thrown?

I can't reproduce the error now, yesterday i update the production env with this changed code.. and the error is not present now. But i'm try to setup a test environment with other Azure Application to try discover the root problem. image

Oi! O que vc alterou no production env? Vc apagou essa parte que está selecionada na imagem?

@drauber
Copy link
Author

drauber commented Jun 6, 2024

Oi! O que vc alterou no production env? Vc apagou essa parte que está selecionada na imagem?

@drauber

I haven't configure SMTP in .env, I only set the azure app id and azure secret token, i want to use only the IMAP of Office365. I don't knwo what other information you need to check if this problem? What else can be useful?

This is fine, you don't need to configure SMTP.
Can you please post the full logs not just the lines which you have added, but the logs from the time when you sent the message and the error is thrown?

I can't reproduce the error now, yesterday i update the production env with this changed code.. and the error is not present now. But i'm try to setup a test environment with other Azure Application to try discover the root problem. image

Oi! O que vc alterou no production env? Vc apagou essa parte que está selecionada na imagem?

Eu não apaguei, eu alterei a parte destacada, deixei exatamente como está no print.

@laianeramos
Copy link

@drauber

I haven't configure SMTP in .env, I only set the azure app id and azure secret token, i want to use only the IMAP of Office365. I don't knwo what other information you need to check if this problem? What else can be useful?

This is fine, you don't need to configure SMTP.
Can you please post the full logs not just the lines which you have added, but the logs from the time when you sent the message and the error is thrown?

I can't reproduce the error now, yesterday i update the production env with this changed code.. and the error is not present now. But i'm try to setup a test environment with other Azure Application to try discover the root problem. image

Oi! O que vc alterou no production env? Vc apagou essa parte que está selecionada na imagem?

Eu não apaguei, eu alterei a parte destacada, deixei exatamente como está no print.

Ah sim! Eu tentei adicionar e não funcionou. O que resolveu pra mim foi apagar o "reply+" de todos os arquivos que achei. Agora está enviando pelo e-mail normal, sem o "reply+".

@pranavrajs pranavrajs added the product Issues related to the product label Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 📮 channel/microsoft-email Issues related to Microsoft email channel need-more-info This issue does not have enough information to start working on it. product Issues related to the product
Projects
None yet
Development

No branches or pull requests

4 participants