Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Read Mailbox - Exchange 2016 #105

Open
3 tasks
diver2567 opened this issue Jun 7, 2024 · 15 comments
Open
3 tasks

Unable to Read Mailbox - Exchange 2016 #105

diver2567 opened this issue Jun 7, 2024 · 15 comments
Labels
bug Something isn't working

Comments

@diver2567
Copy link

diver2567 commented Jun 7, 2024

Are you using the Docker image?

  • [X ] Yes
  • No

Database used

  • [X ] MySQL/MariaDB
  • PostgreSQL
  • SQLite

Error Messages
2024/06/07 09:41:29 [error] 19#19: *3 FastCGI sent in stderr: "PHP message: [critical] Error thrown while running command "app:getreportsfrommailbox". Message: "Could not search mailbox!"" while reading response header from upstream, client: 10.132.34.57, server: _, request: "GET /reports/checkmailnow HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm.sock:",

Steps to Reproduce
Please provide detailed steps to reproduce the problem:
Start Docker Image with docker-compose.yml file modified for IMAP and MYSQL.
Open panel interface and create admin account.
Login to admin account and click Check Mailbox (then the above error is shown within the output when performing docker compose up (rather then -d).

Expected behavior
Reads mailbox and provides output into the panel.

Environment (please complete the following information):

  • OS: [Linux Ubuntu 24.04]
@antedebaas
Copy link
Owner

Which port and encryption method do you use for the imap connection?

@diver2567
Copy link
Author

Which port and encryption method do you use for the imap connection?

Hi Antedebaas, thank you for the response on this.

I had this set to IMAP 993 SSL, I also tried 143 non SSL but that did not work either.

IMAP is working correctly, I've been testing parsemarc's docker version however it's a big docker for a small operation and ideally would like to use your one as it contains the login page for security.

Let me know if there's anything else I can add.

@antedebaas
Copy link
Owner

antedebaas commented Jun 7, 2024

Could you try 993 using starttls?

@antedebaas antedebaas added the bug Something isn't working label Jun 9, 2024
@diver2567
Copy link
Author

Could you try 993 using starttls?

I've spun up parsecmarc dockerized which seems to be working okay.

How do you state starttls within the software? Originally I thought it would be a IMAP issue but given the parsec one is working it would seem it something on the software?

Thanks again and apologises for the delay.

@antedebaas
Copy link
Owner

I think there is something wrong with the way I connect to the mailserver.
But since it works on my server I don’t see what’s wrong. I need to investigate this further

@antedebaas
Copy link
Owner

@tobsowo could you let me know what your authentication security was in #51 ? (or your desired level as i remember)
i want to take that along with this issue

@antedebaas
Copy link
Owner

Note to self. Try encoding

@tobsowo
Copy link

tobsowo commented Jun 25, 2024

This is what I see on my mail server log

2024-06-25T00:42:55.281118Z  INFO session{instance="smtp" protocol=Smtp remote.ip="178.xxx.xxx.xx" remote.port=59033}: smtp::inbound::ehlo: context="ehlo" event="reject" reason="invalid" domain="User"

@antedebaas
Copy link
Owner

@tobsowo what port are you using with what encryption that does not work with this project

@tobsowo
Copy link

tobsowo commented Jun 25, 2024

587 & 993

@antedebaas
Copy link
Owner

antedebaas commented Jun 25, 2024

@tobsowo @diver2567

And with what encryption/ssl/tls settings?

and what is the value of MAILBOX_CONNECTION in the .env.local file?

@tobsowo
Copy link

tobsowo commented Jul 1, 2024

I just checked and I do not have any MAILBOX_CONNECTION value. WHat value do I add?

@antedebaas
Copy link
Owner

/var/www/html/.env.local will always contain that line. It can’t work without it and is auto generated on container startup

@tobsowo
Copy link

tobsowo commented Jul 17, 2024

@antedebaas another thing is this, before now I uses WildDuck for mail server but since I switched to Stalwart I have not been able to connect my mailbox.

Maybe you could install and try in your environment.

https://stalw.art

@Littlericket
Copy link

Littlericket commented Sep 18, 2024

I had the same issue for Exchange 2016, resulting in an error message like the one reported. In my case it was some hidden charset issue.
I've fixed that by patching the getreportsfrommailbox-command, function "open_mailbox" and adding a charset switch to it.
Don't know if this helps here or maybe should be implemented in the app itself, kinda hacky but it works here.

        try {
            retry:
            $mail_ids = $mailbox->searchMailbox('UNSEEN');
        } catch (\Exception $e) {
            if (strpos($e, " [BADCHARSET (US-ASCII)]")) {
                $oldEncoding = $mailbox->getServerEncoding();
                $mailbox->setServerEncoding('US-ASCII');
                $newEncoding = $mailbox->getServerEncoding();

                $log = new Logs;
                $log->setTime(new \DateTime);
                $log->setMessage("Encoding changed dynamically from {$oldEncoding} to {$newEncoding}");
                $this->em->persist($log);
                $this->em->flush();

                goto retry;
            } else {
                error_log($e);
                throw $e;
            }
        }

Produces encoding messages in log like
Encoding changed dynamically from UTF-8 to US-ASCII

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants