No announcement yet.

Email duplicates created by system

  • Filter
  • Time
  • Show
Clear All
new posts

  • Email duplicates created by system


    yesterday we changed our email provider to amazon work mail.

    Since we have changed it, we are facing issues that when we send an email, a duplicate is created by the system. This is happening with both inbound and outbound mails.

    We deleted the original Personal email account and added the new one. Also, the email address of each user has been rewritten in their account, and then Cache was cleared.

    Do you guys have any idea what could be wrong, please?
    When someone sends an email to me, I got it twice in my inbox, 1 created by the sender, and 1 created by the system.
    Also when I send an email, I have it shown twice in my "sent" folder.

    Thanks a lot for the help!

    edit: This is happening only when we are sending emails from CRM to CRM, it is not creating duplicates when we send emails from Outlook to CRM for example.
    Attached Files
    Last edited by Jakub Grufik; 11-09-2022, 06:42 AM.

  • #2
    Hi Jakub,

    Check what message-IDs imported duplicates have (table email > column message_id). It could be that your SMTP (or maybe IMAP?) changes message IDs and Espo can't detect that it's a duplicate. Espo checks duplicates only by message-ID.


    • #3
      There will be the ability to bind a custom implementation of the duplicate finder in the next version.


      • #4
        Likely, that SMTP adds a header with an original message-ID (Microsoft adds X-Microsoft-Original-Message-ID header). The idea is to check this ID too.

        PHP Code:
            public function find(Email $emailMessage $message): ?Email
        = [];

                if (
        $email->getMessageId()) {
        $messageIds[] = $email->getMessageId();

                if (
        $message->getHeader('X-Microsoft-Original-Message-ID')) {
        $messageIds[] = $message->getHeader('X-Microsoft-Original-Message-ID');

                if (
        $messageIds === []) {

        return $this->entityManager
        'messageId' => $messageIds,

        But this will be possible only in v7.3.


        • #5
          yeah both emails have different message_id.

          I am not sure if I understand correctly, but at the moment we are not able to fix this unless the email provider stops changing the ids of the message(that is probably not going to happen), correct?


          • #6
            Correct. Without making modifications to code (that won't work after upgrade) there's no way. But as of v7.3 there's a way. Can you check a message original (raw contents of an email) of any of such emails (in any email client or web interface of your mail provider). Whether it contains an original message ID header.


            • #7
              Hey yuri thanks a lot for the explanation and information.

              Will pass this info to our email administrator to find out what could be done about this behavior.

              Have a nice day sir!