diff --git a/application/Espo/Services/EmailAccount.php b/application/Espo/Services/EmailAccount.php index 5a3c322558..475f510a39 100644 --- a/application/Espo/Services/EmailAccount.php +++ b/application/Espo/Services/EmailAccount.php @@ -320,8 +320,8 @@ class EmailAccount extends Record } if (!empty($email)) { + $this->getEntityManager()->getRepository('EmailAccount')->relate($emailAccount, 'emails', $email); if (!$email->isFetched()) { - $this->getEntityManager()->getRepository('EmailAccount')->relate($emailAccount, 'emails', $email); $this->noteAboutEmail($email); } }