Announcement

Collapse
No announcement yet.

Case Auto Reply - Only works once per email address?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Case Auto Reply - Only works once per email address?

    Hi,

    I have a problem with auto reply's on email to case.

    I have setup a group email with email to case settings.
    I have setup a auto-reply on this.
    The first email from an email address will trigger a auto reply back to the email with the case number.
    Any further emails (new emails not with the case number in them) sent create a new case but the user never gets the auto reply email with the case number.

    I have tested with many email accounts and it is the same in all cases. I have checked the logs for Espo and there is nothing in them. I have checked my mail server logs and there is no record of the missing emails being sent.

    How can I ensure a customer will get an auto reply when they submit a new case via an email?

    Any help greatly appreciated.





  • #2
    Hello,

    > Any further emails (new emails not with the case number in them) sent create a new case but the user never gets the auto reply email with the case number.

    Does new email was sent from the same email address? If so then please take a look at the screenshot below where you have a tooltip.
    Attached Files

    Comment


    • #3
      thanks Maximus, I have done another test this morning and this has worked for the first email again. So this delay appears to be what is causing this.
      The delay seems to be quite long and is causing some issues for my customers. Is the delay configurable? if no do you know where in the code this delay is set so I can adjust it?

      Comment


      • #4
        Hi,
        A followup:

        Espo\Services\InboundEmail.php function autoReply is where this code is located.

        Based on the below an auto reply email will only be sent if no other email has been sent to the email address in 3 hours. This is not ideal.
        I think this should check if this auto reply template has been sent but there may not be enough data to do that check. Alternate would be to check the from name on the previously sent email and see if it matches the new email that is being sent. This way you could setup a different from name on each auto reply email.

        I also think that the 3 hour timeframe should be a config option. If not set then use 3 hours.


        PHP Code:
        protected function autoReply($inboundEmail$email$case null$user null)
        {
        if (!
        $email->get('from')) {
        return 
        false;
        }

        $d = new DateTime();

        $d->modify('-3 hours');

        $threshold $d->format('Y-m-d H:i:s');

        $emailAddress $this->getEntityManager()->getRepository('EmailAddress')->getByAddress($email->get('from'));

        $sent $this->getEntityManager()
        ->
        getRepository('Email')
        ->
        where([
        'toEmailAddresses.id' => $emailAddress->id,
        'dateSent>' => $threshold,
        'status' => 'Sent',
        ])
        ->
        join('toEmailAddresses')
        ->
        findOne();

        if (
        $sent) {
        return 
        false;

        Comment


        • #5
          I have made a pull request here: https://github.com/espocrm/espocrm/pull/1998

          I think there is another change will be needed too
          CEO of Eblasoft
          EspoCRM Expert since 2014
          Full Stack Web Developer since 2008
          Creator of Numerous Successful Extensions & Projects​

          Comment


          • #6
            Guys, you just saved my afternoon.
            I'm evaluating EspoCRM for a switch from Hubspot in our StartUp and this "bug" where only the first reply seems to be sent drove me nuts.
            Thank you very much

            Comment


            • #7
              Yuri has checked in some changes for 6.2.0 related to this https://github.com/espocrm/espocrm/issues/2002

              Comment

              Working...
              X