Unable to send transactional email to more than 2 recipients if there is an attachment
Overview
If you attempt to send a transactional email with an attachment to 3 or more contacts, there is an error:
Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred.
One of parameters (value: ) is not of the type Integer
The first 2 contacts receive the message, but no one else does.
There is no issue observed if there is no attachment, nor if there is an attachment but only 2 recipients.
I replicated the error on two different sites with two different SMTP providers, both running CiviCRM 5.36.1.
This may be related to an issue someone else reported here: https://civicrm.stackexchange.com/questions/39254/contacts-new-email-fails-when-sending-to-more-than-one-contact-after-upgrade-to/39463#39463
Reproduction steps
- View the contacts of a group
- Select 3 or more contacts
- Select action "Email - send now (to 50 or less)"
- Compose a message and include an attachment (I used a pdf that was only 13kb)
Current behaviour
Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred. One of parameters (value: ) is not of the type Integer
Full message in error log:
May 04 19:06:02 [error]
$Fatal Error Details = array:3 [
"message" => "One of parameters (value: ) is not of the type Integer"
"code" => null
"exception" => CiviCRM_API3_Exception {#1944
-extraParams: array:4 [
"tip" => "add debug=1 to your API call to have more info about the error"
"is_error" => 1
"error_message" => "One of parameters (value: ) is not of the type Integer"
"error_code" => "undefined"
]
#message: "One of parameters (value: ) is not of the type Integer"
#code: 0
#file: "/var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/api/api.php"
#line: 133
trace: {
/var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/api/api.php:133 {
› if (is_array($result) && !empty($result['is_error'])) {
› throw new CiviCRM_API3_Exception($result['error_message'], CRM_Utils_Array::value('error_code', $result, 'undefined'), $result);
› }
}
/var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/CRM/Activity/BAO/Activity.php:984 { …}
/var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/CRM/Activity/BAO/Activity.php:1180 { …}
/var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/CRM/Contact/Form/Task/EmailTrait.php:431 { …}
/var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/CRM/Contact/Form/Task/EmailTrait.php:351 { …}
/var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/CRM/Core/Form.php:526 { …}
/var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php:152 { …}
/var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php:119 { …}
/var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php:203 { …}
/var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php:103 { …}
/var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/CRM/Core/Controller.php:347 { …}
/var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/CRM/Core/Invoke.php:313 { …}
/var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/CRM/Core/Invoke.php:69 { …}
/var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/CRM/Core/Invoke.php:36 { …}
/var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/drupal/civicrm.module:458 { …}
/var/www/vhosts/example.org/httpdocs/includes/menu.inc:527 { …}
/var/www/vhosts/example.org/httpdocs/index.php:21 { …}
}
}
]
May 04 19:06:02 [debug] $backTrace = #0 /var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/CRM/Core/Error.php(433): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 /var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/CRM/Core/Invoke.php(39): CRM_Core_Error::handleUnhandledException(Object(CiviCRM_API3_Exception))
#2 /var/www/vhosts/example.org/httpdocs/sites/all/modules/civicrm/drupal/civicrm.module(458): CRM_Core_Invoke::invoke((Array:3))
#3 /var/www/vhosts/example.org/httpdocs/includes/menu.inc(527): civicrm_invoke("group", "search")
#4 /var/www/vhosts/example.org/httpdocs/index.php(21): menu_execute_active_handler()
#5 {main}
Expected behaviour
All recipients should receive mail with attachments without error
Environment information
- CiviCRM: 5.36.1
- PHP: 7.3.27
- CMS: Drupal 7
- Database: MariaDB 5.5.5-10.3.28-MariaDB-log