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:
- Configure Z-Push with BackendIMAP.
- In backend/imap/config.php, set IMAP_DEFAULTFROM to a domain suffix (e.g., @example.com).
- Add the Exchange account to an iOS device using a system username (e.g., user1) instead of a full email address.
- After synchronization, check the account settings on the iPhone.
- Notice the email address is displayed only as user1 (domain missing).
- 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
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:
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:
It should be:
Server (please complete the following information):
Smartphone (please complete the following information):
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