/**
 * SimpleMailHeader.UploadImage API
 *
 * @param array $params
 *
 * @return array API result descriptor
 * @see civicrm_api3_create_success
 * @see civicrm_api3_create_error
 * @throws API_Exception
 */
function civicrm_api3_simple_mail_header_uploadimage($params)
{
    try {
        $result = CRM_Simplemail_BAO_SimpleMailHeader::uploadImage($params);
        return civicrm_api3_create_success($result['values'], $params, NULL, 'uploadimage');
    } catch (CRM_Extension_Exception $e) {
        return civicrm_api3_create_error($e->getMessage());
    }
}