šŸ”“ January 2024 Alert: Forum support inactive!
New forum registration are currently closed.
Use GitHub discussions
.

    UVdesk

    • Login
    • Search
    • Recent

    Solved Fetch emails from a group

    Technical Help
    4
    33
    3269
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • vipin
      vipin developer UVdesk Staff last edited by

      @DD

      As I checked your issue . this is because your raw content.

      Update the following path function given below :

      1. Open the MailboxService file, path of this file is given here :
        -> project-name\vendor\uvdesk\mailbox-component\Services\MailboxService.php

      2. Find the function "getEmailAddress" , you can also see this function around line 150.

      3. Take a backup of the code first and then delete the whole function (only getEmailAddress function) and paste the given code there .

      public function getEmailAddress($addresses)
      {
      $check_mail = "";
      foreach ((array) $addresses as $address) {
      if($address['address'] != null){
      $email = explode(" ",$address['address']);
      $check_mail = $email[1];
      }
      $check_mail = $check_mail ?? $address['address'];
      if (filter_var($check_mail, FILTER_VALIDATE_EMAIL)) {
      return $check_mail;
      }
      }
      return null;
      }

      Now, save the file and run the mailbox refresh command.

      I hope this will work , if not please let me know .

      1 Reply Last reply Reply Quote 0
      • D
        DD last edited by

        I get a Syntax Error.

        1. Processing uvdesk mailbox configuration.
          14:06:11 ERROR [console] Error thrown while running command "uvdesk:refresh-mailbox "italerts@navarino.gr". Message: "syntax error, unexpected '?'" ["exception" => ParseError { …},"command" => "uvdesk:refresh-mailbox "italerts@navarino.gr"","message" => "syntax error, unexpected '?'"]
          It is in the line : $check_mail = $check_mail ?? $address['address']; I believe is the questionmarks.
        vipin 1 Reply Last reply Reply Quote 0
        • vipin
          vipin developer UVdesk Staff @DD last edited by

          @DD

          public function getEmailAddress($addresses)
          {
          $check_mail = "";
          foreach ((array) $addresses as $address) {
          if($address['address'] != null){
          $email = explode(" ",$address['address']);
          $check_mail = $email[1];
          }
          $check_mail = $check_mail ? $check_mail : $address['address'];
          if (filter_var($check_mail, FILTER_VALIDATE_EMAIL)) {
          return $check_mail;
          }
          }
          return null;
          }

          try this once , if you still getting the same error please let me know

          1 Reply Last reply Reply Quote 0
          • D
            DD last edited by

            I got the same error. I run the the refresh-mailbox with --verbose command and i got the below error :

            1. Processing uvdesk mailbox configuration.
              16:38:42 ERROR [console] Error thrown while running command "uvdesk:refresh-mailbox "italerts@navarino.gr" -v". Message: "syntax error, unexpected '?'" ["exception" => ParseError { …},"command" => "uvdesk:refresh-mailbox "italerts@navarino.gr" -v","message" => "syntax error, unexpected '?'"]

            In MailboxService.php line 55:

            [Symfony\Component\Debug\Exception\FatalThrowableError]
            syntax error, unexpected '?'

            Exception trace:
            at C:\wamp\apache2\htdocs\uvdesk\vendor\uvdesk\mailbox-component\Services\MailboxService.php:55
            require() at C:\wamp\apache2\htdocs\uvdesk\var\cache\prod\ContainerKpvVYYE\srcApp_KernelProdContainer.php:516
            ContainerKpvVYYE\srcApp_KernelProdContainer->load() at C:\wamp\apache2\htdocs\uvdesk\vendor\symfony\dependency-injection\Container.php:243
            Symfony\Component\DependencyInjection\Container->make() at C:\wamp\apache2\htdocs\uvdesk\vendor\symfony\dependency-injection\Container.php:225
            Symfony\Component\DependencyInjection\Container->get() at C:\wamp\apache2\htdocs\uvdesk\vendor\uvdesk\mailbox-component\Console\RefreshMailboxCommand.php:60
            Webkul\UVDesk\MailboxBundle\Console\RefreshMailboxCommand->execute() at C:\wamp\apache2\htdocs\uvdesk\vendor\symfony\console\Command\Command.php:255
            Symfony\Component\Console\Command\Command->run() at C:\wamp\apache2\htdocs\uvdesk\vendor\symfony\console\Application.php:952 Symfony\Component\Console\Application->doRunCommand() at C:\wamp\apache2\htdocs\uvdesk\vendor\symfony\framework-bundle\Console\Application.php:87
            Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at C:\wamp\apache2\htdocs\uvdesk\vendor\symfony\console\Application.php:273
            Symfony\Component\Console\Application->doRun() at C:\wamp\apache2\htdocs\uvdesk\vendor\symfony\framework-bundle\Console\Application.php:73
            Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at C:\wamp\apache2\htdocs\uvdesk\vendor\symfony\console\Application.php:149
            Symfony\Component\Console\Application->run() at C:\wamp\apache2\htdocs\uvdesk\bin\console:42

            peopleinside 1 Reply Last reply Reply Quote 0
            • peopleinside
              peopleinside EX helping member @DD last edited by

              @DD Have you tried to clean cache after the php file edit?
              SSH command: php bin/console c:c

              šŸ’¬ You can also ask help on GitHub Discussions
              šŸ”“ I am no more active on Uvdesk
              šŸ”“ Forum support is inactive!

              1 Reply Last reply Reply Quote 0
              • D
                DD last edited by

                Yes i tried clear cache but i am getting the same syntax error

                1 Reply Last reply Reply Quote 0
                • vipin
                  vipin developer UVdesk Staff last edited by

                  Can you please share the screenshot of your updated code. ?

                  1 Reply Last reply Reply Quote 0
                  • D
                    DD last edited by

                    getemailaddress.JPG

                    1 Reply Last reply Reply Quote 0
                    • vipin
                      vipin developer UVdesk Staff last edited by

                      @DD

                      you did not pasted the code in correct formate , That is the reason it is giving you the error . you wrote "public " & "function getEmailAddress($addresses)" in two different line .

                          public function getEmailAddress($addresses)
                          {
                              $check_mail = "";
                              foreach ((array) $addresses as $address) {
                                  if($address['address'] != null){
                                      $email = explode(" ",$address['address']);
                                      $check_mail = $email[1];
                                  }           
                              $check_mail = $check_mail ? $check_mail : $address['address'];
                                  if (filter_var($check_mail, FILTER_VALIDATE_EMAIL)) {
                                      return $check_mail;
                                  }
                              }
                                  return null;
                          } 
                      
                      1 Reply Last reply Reply Quote 0
                      • D
                        DD last edited by

                        Thank you for the reply. As for the "Syntax Error" corrected according to your suggestion.
                        The mail issue still remains. I am getting the emails/tickets of the mailbox and of the group that the mailbox belongs to.

                        1 Reply Last reply Reply Quote 0
                        • D
                          DD last edited by

                          I mean that when i refresh mailbox the i am receiving the emails of the italerts mailbox and not the emails of the IT group that the italerts mailbox is member.

                          1 Reply Last reply Reply Quote 0
                          • vipin
                            vipin developer UVdesk Staff last edited by

                            @DD

                            Okay , now I have done some changes for you .

                            Please follow the given steps:

                            1. Open the MailboxService file, path of this file is given here :
                              -> project-name\vendor\uvdesk\mailbox-component\Services\MailboxService.php

                            2. Open the Updated MailboxService file from here.

                            3. Take a backup of your project MailboxService file first.

                            4. Now copy the whole code from github Updated MailboxService file & past it in your project Mailbox service file .

                            5. run the SSH command: php bin/console c:c & after that run the Mailbox refresh command.

                            I hope this time it will work for you , If not please let me know

                            1 Reply Last reply Reply Quote 0
                            • D
                              DD last edited by

                              Vipin,
                              i've done what you suggest but it doesn't work

                              1 Reply Last reply Reply Quote 0
                              • vipin
                                vipin developer UVdesk Staff last edited by

                                Mailbox refresh command fetch only last 24 hours mail & converted only those mail into ticket .

                                so can you please tell me , you got any mail from group to your email in last 24 ?

                                1 Reply Last reply Reply Quote 0
                                • D
                                  DD last edited by

                                  No unfortunately not. Actually i tried a lot of things before sent a request to the forum.
                                  For example i deleted all the emails from the italerts mailbox , sent a new email to IT group , where italerts is a member , but i didn't receive it.
                                  By the way everything else works fine. Customers created automatically, refresh mailbox works well too when it counts the emails.

                                  1 Reply Last reply Reply Quote 0
                                  • vipin
                                    vipin developer UVdesk Staff last edited by

                                    As you told that italerts is a member in IT group . So whenever someone try to sent mail in IT group. will it automatically shows in IT group member's inbox ?

                                    1 Reply Last reply Reply Quote 0
                                    • D
                                      DD last edited by

                                      Yes that's true. I tried several Helpdesk systems before and all of them worked with fine with this.

                                      1 Reply Last reply Reply Quote 0
                                      • vipin
                                        vipin developer UVdesk Staff last edited by

                                        okay send one new mail to IT group . then check in italerts member inbox , when it will receive in inbox then after run the mailbox refresh command. but makesure you have done the updates which i shared you the last .

                                        Also take the screenshots of each steps which you followed.

                                        1 Reply Last reply Reply Quote 0
                                        • D
                                          DD last edited by

                                          1. I delete everything from the italerts mailbox.
                                          2. I sent an email to IT@ and the italerts receive it.
                                          3. Restart Apache.
                                          4. Clear cache ( php bin/console c:c )
                                          5. Run the refresh command. (below is the screenshot)
                                            image_2021-05-26_132657.png
                                          6. Nothing appeared in the Tickets link of UVDesk
                                          1 Reply Last reply Reply Quote 0
                                          • vipin
                                            vipin developer UVdesk Staff last edited by

                                            So Mail is converted into ticket or not ?

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post