This change allows the user to configure both IMAP and SMTP for an email inbox. IMAP enables the user to see emails in Chatwoot. And user can use SMTP to reply to an email conversation.
Users can use the default settings to send and receive emails for email inboxes if both IMAP and SMTP are disabled.
Fixes#2520
* Bugfix: Private notes in emails
Private notes were sent in the emails as part of
conversation continuity. Fixed this issue.
Also made the changes to not even queue the mails
if message is a private note.
* Bugfix: Change issue with featurable in signup - passing array
* Bugfix: Added specs for checking private notes being sent in email
* Chore: Feature lock email settings in UI
The email settings under account settings needed to be
feature locked in a way different from teh current way for it
to be enabled for accounts in a self hosted scenario.
Some refactorings were also done along with this change.
1. There was a feature flag defined in code in account model called
domain_emails_enabled was used to check if the inbound emails was
enabled for the account. But there was already a feature flag called
"inbound_emails" defined in features.yml. So changed to use this to
check if inbound emails are enabled for an account.
2. Renamed and re-purposed existing `domain_emails_enabled` to
`custom_email_domain_enabled` to use for feature toggling the UI
for email settings.
3. To enable & disable multiple features using the featurable concern
we were passing an array of values. Changed this to accept a comma
separated set of values.
* Chore: Feature lock email settings in UI
Fixed the specs for accounts controller & removed
unneccessary code from Account seetings component in UI
* Chore: Convert newlines to <br>s
Removed the layout used while sending replies in
conversation continuity.
Converted the newlines in the messages to <br/> tags
for the correct HTML rendering.
* Chore: Bug fix in reply email domain
Renamed the function custom_email_domain_enabled to
inbound_email_enabled.
Fixed bug on setting reply emails's domain.
For the outgoing emails which has dependency on the incoming
part as well like the conversation continuity part, some of the
config variables used were entirely based on the account attributes.
But this is not true in case of self hosted situations where you have
multiple accounts and have a common config for incoming emails.
So moved out some of the attributes entirely dependednt on the account
to ENV with a fallback to the Global config.
Also, with this changes the name of the agent will be shown in the
email clinet with in the conversation rather than just the support
email address. This has a huge UX impact on the cutomer.
Modified all the necessary unit tests to reflect these changes.
Updated the .env.example file for the new ENV variable.
* Chore: Change the prefix in reply emails
In conversation continuity the reply to email was looking like
reply+to+{some_random_hex_id}@reply.chatwoot.com
Changed the prefix to just `reply` instead of `reply+to`.
* Chore: Change reply email prefix in outbound emails
Changed the prefix from `reply+to+` to just `reply+` in
the reply emails in the converstaion related outbound emails.
Right now as part of conversation continuity, we are using the
ConversationReplyMailer which sends a summary of messages including
the incoming messages when an agent replies. Ideally, we want
to send only the reply of that agent and not a summary when
Conversation continuity is enabled. Added the functionality
to send the reply email without summary. Added required unit
tests to cover the changes.
ref: #1048
* Added custom Message-ID and In-Reply-To headers for conversation reply emails
* Added new global config for the default domain (This is used in the above headers)
* Added migration to run the config loader to load the new global config value
* The subject of the conversation reply mailer was made static (This is required for threaded emails)
* Added required tests