Skip to content

[IMAP Backend] Domain missing in SMTPAddress with system user authentication #185

@whitepig47

Description

@whitepig47

Describe the bug
When using the IMAP backend with system user authentication (e.g., users defined in /etc/passwd), Z-Push fails to include the domain part in the SMTPAddress within the Settings response. This causes iOS devices to treat the account as "send-disabled," resulting in the account appearing without a domain in the iOS settings and the "From" address being missing or non-selectable in the Apple Mail app.

To Reproduce
Steps to reproduce the behavior:

  1. Configure Z-Push with BackendIMAP.
  2. In backend/imap/config.php, set IMAP_DEFAULTFROM to a domain suffix (e.g., @example.com).
  3. Add the Exchange account to an iOS device using a system username (e.g., user1) instead of a full email address.
  4. After synchronization, check the account settings on the iPhone.
  5. Notice the email address is displayed only as user1 (domain missing).
  6. Try to compose a new mail; the account's email address is not available in the "From" field.

Expected behavior
Z-Push should respect the IMAP_DEFAULTFROM setting and return the full email address (username@domain) in the Settings response so that the mobile device can correctly identify the sender's address.

Logs
The WBXML log shows that the server sends an incomplete address:

<Settings:UserInformation>
 <Settings:Get>
  <Settings:EmailAddresses>
   <Settings:SMTPAddress>username</Settings:SMTPAddress>
  </Settings:EmailAddresses>
 </Settings:Get>
</Settings:UserInformation>

It should be:

<Settings:SMTPAddress>username@example.com</Settings:SMTPAddress>

Server (please complete the following information):

  • OS: Debian GNU/Linux 11 (bullseye)
  • PHP Version: php7.4
  • Backend for: IMAP
  • and Version: Z-Push 2.6.4+0-0

Smartphone (please complete the following information):

  • Device: iPhone
  • OS: iOS 26.3.1 (a)
  • Mail App: Apple Mail
  • Version: N/A

Additional context
The issue lies in src/backend/imap/imap.php. Several methods, including Logon and settingsUserInformation, assign $this->username directly to email address fields without appending the domain.

A suggested fix is to use the existing getDefaultFromValue($username, $domain) function in imap.php to ensure the IMAP_DEFAULTFROM configuration is respected.

imap.php.patch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions