[Solved] Autoconfiguration not working for iOS / Z-Push Support

I have an up-to-date Mail-in-a-Box instance serving multiple domains and autoconfiguration for my iPhone using the default Mail app used to work perfectly. But lately, when I set up an older iPhone (don’t know if age is relevant), autoconfiguration does not work and I am asked to type in the imap and smtp domains by hand. Note that manual configuration appears to succeed, showing green checks for each of the validation categories. While this works fine for imap, it does not work correctly for smtp:

Cannot Send Mail

The server rejected one of the recipient’s addresses. The message has been placed in your Outbox.

Possibly of importance, although I can’t see why, all accounts but the administrative email account use a domain without DNSEC support because the TLD does not support it. The autoconfig and autodiscover subdomains all have valid certificates for all domains that have real (not aliases) email addresses.

I have noticed that smtp gets configured with port 587 although 465 is now preferred. If I try to manually change the port to 465, it just hangs while attempting to validate the new settings.

Any help at all will be most appreciated!

Have you tried importing the config file to IOS devices
Just type in the bowser


Go to Settings and hit the config file

It is an IMAP config. Prior to this delete the old Accounts that fail from Mail.

That worked! Many thanks!

So is the failure when I try to directly configure my account using the usual procedure a bug? Should I report this on github?

I think that you are right about the port.
All else is true in the admin instructions page. @JoshData should remedy the instructions probably next time.
For active sync read iPad Profile won't log in - #5 by vele

What I find to be funny is I purposely configure my iOS native mail app with IMAP, carddav, caldav and don’t use auto configure (which is zpush) because I have issues with at service and it’s obviously working for you!

The zpush project was for a short period of time not being actively being maintained by its creator.

It looks like it has a new maintainer so I’m hoping to see really good thing s from that — @matidau :slight_smile:

It’s also been advertised as not a “supported” feature but a beta feature as far as Mail in a Box goes (from my understanding) @JoshData - please correct me if I’m wrong.

I find Active Sync in the current version to work for a couple of weeks and then beraks all of a sudden. As if it is not a computer code but as if it has consciousness all by itself.
Funny. I hope it will become reliable in the future for us to get real Push messages.
For now I use Spike for IOS ‎Spike: Email & Team Chat on the App Store
If you don’t mind being logged in to a Russian service. It uses IMAP and it does provide Push in real time.

@matidau Hope to see a more reliable z-push in the next version. Thanks

For just a little over a year, thanks for the shout out.

I find this comment interesting. When this happened did you try using the fix states option of Z-Push admin, or restart the server, to see if that resolved it?

I think this is the second time someone mentioned that it worked for a little bit and then would stop after some time. And my first two thoughts are either the Z-Push states are a problem or a memory leak has occurred in Z-push via PHP fpm.

The other possibility is that there is another PHP 8 bug that hasn’t been fixed yet, but this would show up in the logs.

With my setup and how I use it I don’t have any issues with Z-Push. My only non standard part on the server is that I restart religiously every week, not for Z-Push just how I roll on my servers. Then on the client side I’m on Android and I also keep almost no mail in my inbox deleting most of them and saving a couple in other folders. This may make me a bit of an edge case as far as usability goes.

If anyone is willing to spend the time to fix it, including logging the issue on the Github repo Issues · Z-Hub/Z-Push · GitHub it would be appreciated.

How do I check the logs and which logs. I have PHP 8.0.30 (cli)?

Neither a restart, nor
sudo z-push-admin -a fixstates

/var/log/z-push is the location of the log files.


15/05/2024 10:55:37 [ 1931] [FATAL] [xxx@zz.org] Exception: (ProvisioningRequiredException) - Retry after sending a PROVISION command

Error Log:

11/05/2024 19:31:57 [3513454] [FATAL] [xxx@zz.org] FatalException: Requested the Z-Push URL without the required GET parameters - code: 0 - file: /usr/local/lib/z-push/i>
11/05/2024 19:31:57 [3513454] [FATAL] [xxx@zz.org] Exception: (FatalException) - Requested the Z-Push URL without the required GET parameters

Normally that is the message when accessing /Microsoft-Server-ActiveSync through the browser and not a phones mail client.

Is this what you are getting when using your phone?

This is saying that the user/device hasn’t been provisioned yet. If you remove the account from the phone and then re add it does it start working?

Last time I remeber using z-push-admin -a remove -d fp1a6812ah747fbkkobqt3fjc8

Bla Bla Bla.

And readded. It worked for a while and it stopped. Mail app is receiving push from outlook so it might not be an IOS issue (although it might, with all their update xrap) but I have no android to test. It is not worth wasting time since there is this Spike app that makes Push work. So just chill. If you need additional info I am willing to contribute. And if there is anyone else using Active Sync via Ipad/Iphone please respond if it is working.

I thought I was being pretty chill :blush: you can feel free to ignore me.

If you have time do you mind changing Loose Provisioning to true in /usr/local/lib/z-push/config.php

define('LOOSE_PROVISIONING', false);

I think I might need to get my hands on an iPhone to investigate this further otherwise.

On a more serious note: done as requested.
define(‘LOOSE_PROVISIONING’, true);

Deleted and added back again the account. Restart.

but it still gives the FATAL on readding the account:
error Log:
16/05/2024 10:08:13 [ 1876] [FATAL] [e@.org] Exception: (ProvisioningRequiredException) - Retry after sending a PROVISION command

This might be related to the way it autoconfigs the incoming server and leaves the username without the domain part after @. And it fills in the email field with 2 domains and 2 @ (username@domain.com@username@domain). But this is no problem you can edit this after adding the account just hit save and edit.

However, there is a more serious issue as sending does not work at all because after successful autocinfig, maybe because autoconfig uses just the username part which you edit on failure, in the Outgoing server, and when I try sending the error log looks like this,

16/05/2024 10:50:39 [ 1880] [ERROR] [username@xx.zz.org] Mail error: sendmail returned error code 75

PUSH DOES work however Sending DOES NOT. On IOS Iphone there is no way to edit the Exchange Outgoing server. To achieve sending I add the identical account as IMAP and use it for sending.

Also check, by default IOS disables the Alerts (or the autocnfig does this?) when readding the account so go to

Notifications>Mail>Customize Notifications>YOUREXCHANGE Account>Alerts >>turn it on.

And now push works.

I will report back when it stops.

What you have described sounds like the Z-Push autodiscover isn’t working.

What is in your autodiscover.log and autodiscover-error.log?

Edit: And if you haven’t already you might want to set you log level to LOGLEVEL_DEBUG in autodiscover/config.php

Just to check when re-adding the account again, did you still have to manually enter or edit any details apart from email address and password? If you did then autodiscover may still not be working.

Are you running a version earlier than mailinabox v65 and Z-Push 2.7.1? In version 2.7.1 we fixed the Z-Push version number so it didn’t just produce GIT. But if you remove the version text file this is the same behaviour.

I re-added the account as normal no manual edits of details. Just password.

I am running . mailinabox version v68.

I am not sure which version is z-push. How do I check? Please note I am on an arm64 instance. Never removed any version txt file!

Could always be another bug but with autodiscover :frowning:

The version file is /usr/local/lib/z-push/version and should be 2.7.1

I confirm it is 2.7.1

1 Like

This is sendmail not able to access its config file. Might be a permissions issue?

And this usually happens on a large mailbox. You may need to be patient to let this run through and these messages to stop.

And thanks for confirming the version :blush: edit: I’ve created an issue to remind me to check in to what is happening with this later.