All about Email #4449
bschmalhofer
started this conversation in
Ideas
All about Email
#4449
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Email-Handling in OTOBO is importants and complex. Improvements in that area migh have large benefits. So this discussion has three goals.
30_000 ft view
There is a plethora of email related modules on CPAN. Many modules are clearly obsolete or no longer maintained. The maintained modules can be classified into different groups:
Use cases in OTOBO
Receiving mails
OTOBO fetches mails either with POP3 or IMAP. Both protocols have variants which encrypt the data transfer.
These choices look sensible. I looked at Mail::Transport::IMAP4 and it turns out that it is based on Mail::IMAPClient.
Parsing mails
This is done in
Kernel::System::EmailParser. Mail::Internet and M̀IME::Tools are used internally. Using both modules is kind of redundant, as there is no good reason for parsing the Email twice. Even though Mail::Internet only extracts the headers and does not parse MIME.Alternatives are Mail::Message and Email::MIME
This is addressed in #4469 . The approach is to stick with
Main::Internetbut avoid the double parsing.Parsing Lists of Email Addresses
This is a common use case in OTOBO as MIME article data keeps the complete header line in the database. Currently
Mail::Addressis used for that. Greppinggrep -r 'Mail::Address->parse(' | wc -lreports 72 lines.However this module is not very performant.
Email::AddressorEmail::Address::XSmight be alternatives. See the benchmarkbenchmark_address_parsing.pl.txt. In this benchmark caching is annulled.
The fastest module is
Email::Address::XS. The C library used inEmail::Address::XSis based on Dovecot which I interpret as that it is battle tested.The POD of Email::Address recommends using
Email::Address::XS. IfEmail::Address::XSis used, then at least version 1.05 from 2022 should be required. See pali/Email-Address-XS#5 .Here is the availability of the
Email::Address::XSas reported by https://pkgs.org/search/?q=email-address-xs&on=name :See also #5483 .
Checking Email Addresses
This is done in
Kernel::System::CheckItem::CheckEmail(). Internally some regexes and the CPAN modulesEmail::Valid,Net::DNS, andNet::DNS::Resolverare used.The list of used modules looks sensible.
Emai::Validbelongs to the Email::* universe. It could also do the mx check, that is the DNS check, usingNet::DNS.Email::Validhas some quirks, see Perl-Email-Project/Email-Valid#16 and Perl-Email-Project/Email-Valid#36 . But that seems to be considered in OTOBO, whereCheckEmail()is usually called only on plain email addresses.See also #637 and #5498 .
Constructing the From-line of emails to be sent
This depends on the queue, settings in the SysConfig, and the name of the agent.
See Kernel::System::TemplateGenerator::Sender.
Mail::Addressis used there.Constructing mail
This is done in
Kernel::System::Email::Send(). M̀IME::Entity`is used internally.Sending mails
Besides the test backends there are two ways of actually sending Emails from OTOBO.
These look like sensible choices.
Actions
All reactions