Title: PHP 8.x TypeError + empty From Address
Last modified: July 14, 2026

---

# PHP 8.x TypeError + empty From Address

 *  [Diiamo](https://wordpress.org/support/users/luislu/)
 * (@luislu)
 * [3 days, 7 hours ago](https://wordpress.org/support/topic/php-8-x-typeerror-empty-from-address/)
 * Hi Zoho Mail Team,
 * I’m writing to report a compatibility issue with the Zoho Mail plugin (v1.6.3)
   
   running on PHP 8.3 + WordPress. After OAuth authentication succeeds, theFrom 
   Email Address dropdown remains empty, and the plugin throws PHP errors. Root 
   Cause (Two Issues) Issue 1: PHP 8.x Strict Typing
 * The plugin uses `count()` and `foreach()` on `sendMailDetails` without
   null-checking.
   In PHP 7.x this silently returned 0 / skipped, but PHP 8.xthrows TypeError:
 * Line 380: count($jsonbodyAccounts->data[$i]->sendMailDetails)
   → TypeError: count():
   Argument #1 must be Countable|array, null given
 * Line 618: foreach ($account->sendMailDetails as $mailDetail)
   → Warning: foreach()
   argument must be array|object, null given
 * Issue 2: Zoho API No Longer Returns sendMailDetails
 * When calling `https://mail.zoho.com/api/accounts` with a valid OAuth token,
   the
   response no longer includes the `sendMailDetails` field for some accounttypes.
   The account object has `primaryEmailAddress` (string) and`emailAddress` (array
   of objects), but `sendMailDetails` is simply absent.
 * This means even after fixing Issue 1, the dropdown has no data to display. Fix
   Applied
 * Three changes in zohoMail.php: Change 1 — Null-safe count() (line ~380)
 * `php<br>// Before<br>for ($j = 0; $j < count($jsonbodyAccounts->data[$i]->sendMailDetails);
   $j++) {</p> <p>// After<br>if (is_array($jsonbodyAccounts->data[$i]->sendMailDetails)
   <br>&& count($jsonbodyAccounts->data[$i]->sendMailDetails) > 0) {<br>for ($j 
   = 0; $j < count($jsonbodyAccounts->data[$i]->sendMailDetails); $j++) {</p> <p
   ></p> <p>Change 2 — Null-safe foreach() (line ~618)</p> <p>// Before<br>foreach(
   $account->sendMailDetails as $mailDetail) {</p> <p>// After<br>if (is_array($
   account->sendMailDetails) && count($account->sendMailDetails) > 0) {<br>foreach(
   $account->sendMailDetails as $mailDetail) {</p> <p></p> <p>Change 3 — Fallback
   to primaryEmailAddress (lines ~391 and ~635)</p> <p>// When sendMailDetails is
   empty, use primaryEmailAddress as fallback<br>} elseif (!empty($account->primaryEmailAddress)){
   <br>$fromAddress = $account->primaryEmailAddress;<br>// … render option<br>}</
   p> <p></p> <p>Environment</p> <ul> <li>WordPress: latest</li> <li>PHP: 8.3.32(
   NTS)</li> <li>Plugin: Zoho Mail 1.6.3</li> <li>Server: Debian 10, Nginx</li> 
   </ul> <p>Suggested Permanent Fix</p> <p>Consider using <code>primaryEmailAddress
   </code> as the primary data source (it’s always<br>a string and always present),
   falling back to iterating <code>emailAddress</code> array<br>or <code>sendMailDetails
   </code> if needed. This would be more robust across Zoho API<br>versions.</p>
   <p>Thanks,</p>

Viewing 1 replies (of 1 total)

 *  Thread Starter [Diiamo](https://wordpress.org/support/users/luislu/)
 * (@luislu)
 * [3 days, 6 hours ago](https://wordpress.org/support/topic/php-8-x-typeerror-empty-from-address/#post-18964548)
 * I already use DeepSeek fix this issue, the plugin works well now.

Viewing 1 replies (of 1 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fphp-8-x-typeerror-empty-from-address%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/zoho-mail/assets/icon-256x256.png?rev=1922694)
 * [Zoho Mail for WordPress](https://wordpress.org/plugins/zoho-mail/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/zoho-mail/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/zoho-mail/)
 * [Active Topics](https://wordpress.org/support/plugin/zoho-mail/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/zoho-mail/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/zoho-mail/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [Diiamo](https://wordpress.org/support/users/luislu/)
 * Last activity: [3 days, 6 hours ago](https://wordpress.org/support/topic/php-8-x-typeerror-empty-from-address/#post-18964548)
 * Status: not resolved