mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-03 12:37:56 +00:00
- Support for plus forwarding in the email addresses for email channels Co-authored-by: Sojan <sojan@pepalo.com>
14 lines
466 B
Ruby
14 lines
466 B
Ruby
module EmailHelper
|
|
def extract_domain_without_tld(email)
|
|
domain = email.split('@').last
|
|
domain.split('.').first
|
|
end
|
|
|
|
# ref: https://www.rfc-editor.org/rfc/rfc5233.html
|
|
# This is not a mandatory requirement for email addresses, but it is a common practice.
|
|
# john+test@xyc.com is the same as john@xyc.com
|
|
def normalize_email_with_plus_addressing(email)
|
|
"#{email.split('@').first.split('+').first}@#{email.split('@').last}".downcase
|
|
end
|
|
end
|