Unable to send emails
-
I am unable to send emails via z-push client due to the recipient missing. Receiving/reading emails works just fine.
I believe the problem lies in this line from the error log:
/usr/share/z-push/include/mimeDecode.php:529 Uninitialized string offset 0 (2)
Here are the error logs with full logging enabled:
29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] -------- Start 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] cmd='SendMail' devType='iPhone' devId='DEVICE_ID' getUser='user@domain.tld' from='USER_IP' version='2.6.2' method='POST' 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] Used timezone 'Etc/UTC' 29/03/2021 08:14:55 [ 5319] [ INFO] [user@domain.tld] [DEVICE_ID] BackendIMAP(): Using UTF-8 as Default Charset for Searches 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] Request::ProcessHeaders() ASVersion: 14.0 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] ZPush::CommandNeedsProvisioning(1): true 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] FileStateMachine->GetState() read '9333' bytes from file: '/var/lib/z-push/s/p/DEVICE_ID-devicedata' 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] ASDevice data loaded for user: 'user@domain.tld' 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] InterProcessData:__construct type: 'DEVICE_ID' 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] TopCollector initialised with IPC provider 'IpcMemcachedProvider' with type '20' 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] InterProcessData:__construct type: 'DEVICE_ID' 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] LoopDetection initialised with IPC provider 'IpcMemcachedProvider' with type 'DEVICE_ID-1337' 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] ZPush::HierarchyCommand(1): false 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] DeviceManager->ProvisioningRequired('215982743') saved device key '215982743': false 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] DeviceManager->getPolicyName(): determined policy name: 'default' 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] DeviceManager->getProvisioningPolicies(): loaded 'default' policy. 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] ZPush::CommandNeedsAuthentication(1): true 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] BackendIMAP->Logon(): User 'user@domain.tld' is authenticated on '{mail.alt.domain.tld:993/imap/ssl}' 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] ZPush::CommandNeedsPlainInput(1): false 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] BackendIMAP->SendMail(): RFC822: 1 bytes forward-id: 'false' reply-id: 'false' parent-id: 'false' SaveInSent: 'true' ReplaceMIME: 'false' 29/03/2021 08:14:55 [ 5319] [WBXML] [user@domain.tld] [DEVICE_ID] 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] BackendIMAP->SendMail(): We get the new message 29/03/2021 08:14:55 [ 5319] [WARN] [user@domain.tld] [DEVICE_ID] /usr/share/z-push/include/mimeDecode.php:529 Uninitialized string offset 0 (2) 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] BackendIMAP->SendMail(): We get the From and To 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] BackendIMAP->getFromHeaderValue(): No From address defined, we try for a default one 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] BackendIMAP->setReturnPathValue(): No Return-Path address defined, we use From 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] BackendIMAP->SendMail(): is a new message or we are replacing mime 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] BackendIMAP->SendMail(): Copying new headers 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] BackendIMAP->SendMail(): Final mail to send: 29/03/2021 08:14:55 [ 5319] [WBXML] [user@domain.tld] [DEVICE_ID] MIME-Version: 1.0 : From: user@domain.tld Return-path: user@domain.tld Content-Type: multipart/mixed; boundary="=_a52f8a0976f89ebfa33b87bd168451c2" 29/03/2021 08:14:55 [ 5319] [WBXML] [user@domain.tld] [DEVICE_ID] Body: This is a multi-part message in MIME format. Body: --=_a52f8a0976f89ebfa33b87bd168451c2 Body: Content-Type: multipart/alternative; Body: boundary="=_0932d3ab486ec6973ffec0c842e1a38b" Body: Body: Body: --=_a52f8a0976f89ebfa33b87bd168451c2-- Body: 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] BackendIMAP->sendMessage(): SendingMail with mail 29/03/2021 08:14:55 [ 5319] [ERROR] [user@domain.tld] [DEVICE_ID] Mail<mail> error: mail() returned failure 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] BackendIMAP->sendMessage(): send return value 29/03/2021 08:14:55 [ 5319] [ INFO] [user@domain.tld] [DEVICE_ID] StatusException: BackendIMAP->sendMessage(): The email could not be sent - code: 120 - file: /usr/share/z-push/backend/imap/imap.php:2659 29/03/2021 08:14:55 [ 5319] [WARN] [user@domain.tld] [DEVICE_ID] HTTPReturnCodeException: BackendIMAP->sendMessage(): The email could not be sent - code: 500 - file: /usr/share/z-push/lib/request/sendmail.php:152 29/03/2021 08:14:55 [ 5319] [FATAL] [user@domain.tld] [DEVICE_ID] WBXML 10K debug data: 29/03/2021 08:14:55 [ 5319] [ INFO] [user@domain.tld] [DEVICE_ID] User-agent: 'Apple-iPhone11C2/1804.52' 29/03/2021 08:14:55 [ 5319] [FATAL] [user@domain.tld] [DEVICE_ID] Exception: (HTTPReturnCodeException) - BackendIMAP->sendMessage(): The email could not be sent 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] LoopDetection->ProcessLoopDetectionTerminate() 29/03/2021 08:14:55 [ 5319] [ INFO] [user@domain.tld] [DEVICE_ID] cmd='SendMail' memory='1.86 MiB/4.00 MiB' time='0.13s' devType='iPhone' devId='DEVICE_ID' getUser='user@domain.tld' from='USER_IP' idle='0s' version='2.6.2' method='POST' httpcode='500' 29/03/2021 08:14:55 [ 5319] [DEBUG] [user@domain.tld] [DEVICE_ID] -------- End 29/03/2021 08:15:05 [ 5222] [DEBUG] [user@domain.tld] [DEVICE_ID] BackendIMAP->close_connection(): disconnected from IMAP server
Any help is much appreciated.
-
This post is deleted! -
Hi @grawlinson,
how does the “To” in your case look like? Does it have some special chars? Does sending emails fail for all the recipients? Are other users on your system able to send emails via Z-Push and using a mobile device?
Manfred
-
@manfred The “To” email is similar to firstname@lastname.tld (all ASCII characters)
I’m the guinea pig before I roll it out to a few others, so there is only one user at the moment.
Sending emails fails even if I specify “TO”, “CC” and “BCC”.
I can receive and move/delete emails just fine, it is only sending that is the problem.
Please let me know what other information you require (OS, configuration, etc), I’m happy to provide.
EDIT:
OS is Arch Linux (5.11.x kernel), PHP 8.0.3, using php-fpm and nginx.
More detailed configuration can be provided.
-
Inserting
ZLog::Write(LOGLEVEL_WARN, sprintf(Utils::PrintAsString($sm)));
after line 229 inbackend/imap/imap.php
returns this in the log:14/04/2021 00:49:38 [183682] [WARN] [user@domain.tld] SyncSendMail ( (S) clientid => null (S) saveinsent => true (S) replacemime => null (S) accountid => null (S) source => null (S) mime => (S) replyflag => null (S) forwardflag => null unsetVars(Array) size: 0 supportsPrivateStripping => false flags => false content => null )
Any hints as to why z-push on the server is receiving nothing from an iOS device?
-
Hi @grawlinson,
did you actually remove “To:” from the log in your first post or wasn’t it really there?
A problem might be that you’re using PHP 8. We didn’t test Z-Push with PHP 8 yet, so it’s possible that there are some issues.
It would be more helpful if you would post $sm->mime contents instead of just $sm.
Manfred
-
Are there any other errors or warnings logged in other logfiles? (/var/log/nginx/error.log or similar…)
I am using Arch Linux too, but I have not upgraded to PHP 8 yet.
Has it been working for you in the past or is this a new installation? -
@manfred said in Unable to send emails:
Hi @grawlinson,
did you actually remove “To:” from the log in your first post or wasn’t it really there?
A problem might be that you’re using PHP 8. We didn’t test Z-Push with PHP 8 yet, so it’s possible that there are some issues.
It would be more helpful if you would post $sm->mime contents instead of just $sm.
Manfred
The
To:
component wasn’t there. And$sm->mime
is empty.@bob4os said in Unable to send emails:
Are there any other errors or warnings logged in other logfiles? (/var/log/nginx/error.log or similar…)
I am using Arch Linux too, but I have not upgraded to PHP 8 yet.
Has it been working for you in the past or is this a new installation?No errors in nginx or php-fpm, just this from the mail-server:
postfix/sendmail[221148]: fatal: user@domain.tld(968): No recipient addresses found in message header
, which isn’t exactly helpful because the error occurs well before that.It’s worked fantastically for a couple of years now, could be the upgrade to PHP 8. I’ll revert back to PHP 7.x and see if that is the cause.
EDIT: Still unable to send on PHP 7.x, not sure what else to look at, considering everything but sending e-mails works.
-
mimeDecode.php:529 is looking at the first character of each line of the header - uninitialized would indicate, that there is no header present at all.
Which branch are you on? develop, master or release?
-
@bob4os 2.6.2 from the tagged git release.