mailwatch / MailWatch

MailWatch for MailScanner is a web-based front-end to MailScanner
http://mailwatch.org/
GNU General Public License v2.0
117 stars 66 forks source link

IMAP Login Failures #1210

Closed pidydx closed 3 years ago

pidydx commented 3 years ago

Issue summary

MailWatch configured for IMAP authentication does not work with an IMAP server that does not use the full email address as the login.

Steps to reproduce

  1. Configure IMAP server to use username rather than username@maildomain.tld for the login
  2. Configure MailWatch to use IMAP authentication with that IMAP server
  3. Attempt to login

Expected result

User should be logged in stripping the @maildomain.tld if necessary for IMAP authentication (automatically or configurable).

Actual result

Using only username: No attempted login - https://github.com/mailwatch/MailWatch/blob/1.2/mailscanner/functions.php#L3208

Using username@maildomain.tld: imap_open(): Couldn't open stream ...

Installation

Version and method

endelwar commented 3 years ago

I could add a new BC configuration flag that disables the full email check

endelwar commented 3 years ago

@pidydx could you test the linked PR?

pidydx commented 3 years ago

I'm working on being able to actually test it, but I'm not sure that change will work as intended. Doesn't mailwatch need to store the full email as the username for determining which emails belong to the user? I would expect that a user still needs to login with user@maildomain.tld and that the username needs to get checked as a valid email address, but then the config flag just changes what value gets used for the imap_open() call (user or user@maildomain.tld).

endelwar commented 3 years ago

yes, you're right, I need to strip the domain part of the email and pass only the local-part (or IMAP username)

endelwar commented 3 years ago

should be working as expected now

endelwar commented 3 years ago

@pidydx did you test this PR?

pidydx commented 3 years ago

Unfortunately I'm not really able to since I had to reconfigure to get around the problem.