*

Rob

  • **
  • 7 posts
Alerts does not send emails to non-members
« on: January 07, 2026, 04:20:26 AM »
[ Running on OsClass v8.2.1 & PHP 8.3 (not ready to upgrade to OsClass 8.3 yet, testing stage) ]


Alert emails (new listings notifications: hourly, daily, weekly) are not being sent out to non-member 'users' (user id <> 0).
Alert emails only go out to member emails.

Has anyone ran across this and/or have any suggestions on resolving this issue?

Thank you!
« Last Edit: January 08, 2026, 02:52:22 AM by Rob »

*

MB Themes

Re: Alerts does not send emails to non-members
« Reply #1 on: January 08, 2026, 04:31:04 PM »
Check mail server.
Check cron.
Enable debug log.
Enable php mailer debug log.
Keep logs in file.
Review all logs after trigger.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Rob

  • **
  • 7 posts
Re: Alerts does not send emails to non-members
« Reply #2 on: January 08, 2026, 05:21:37 PM »
The mail server and cron work as the process runs and emails to registered users go out.
(Also found that the alerts go out to the email as it shows in the account and not in the alerts table.)

Are there any filters (other then active users/alerts) when picking to which user(s) to send the alert(s)?
« Last Edit: January 08, 2026, 10:26:48 PM by Rob »

*

Rob

  • **
  • 7 posts
Re: Alerts does not send emails to non-members
« Reply #3 on: January 09, 2026, 06:30:41 AM »
   If I'm understanding this correctly, it looks like the query is taking the email address from the alerts table and attempting to match it to a registered user in user table.

...
if ($alert['fk_i_user_id'] > 0) {
 $user = $mUser->findByPrimaryKey($alert['fk_i_user_id']);
...

...
EXPLAIN SELECT *
FROM (oc_t_user)
WHERE s_email = 'my@email.address'
...

Shouldn't this be: "... t_alerts ..." ?

*

MB Themes

Re: Alerts does not send emails to non-members
« Reply #4 on: January 09, 2026, 01:36:59 PM »
Don't look on 1 line, look on whole block. If you rewrite it properly you get.

Code: [Select]
            if(!isset($alert['pk_i_id']) || !isset($alert['s_email'])) {
              continue;
            }
           
            $user = array();
           
            // Find user record
            if($alert['fk_i_user_id'] > 0) {
              $user = $mUser->findByPrimaryKey($alert['fk_i_user_id']);
            } else {
              $user = $mUser->findByEmail($alert['s_email']);
            }
           
            // User not found
            if($user === false || !isset($user['pk_i_id'])) {
              $user = array(
                's_name'  => $alert['s_email'],
                's_email' => $alert['s_email']
              );
            }
           
            // Only trigger alert to non-banned users
            if(osc_is_email_banned($user['s_email']) !== false) {
              osc_run_hook('hook_' . $internal_name, $user, $ads, $alert, $items, $totalItems);
              AlertsStats::newInstance()->increase(date('Y-m-d'));
            }

Means you use user record email & name if exists, otherwise use alert data.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Rob

  • **
  • 7 posts
Re: Alerts does not send emails to non-members
« Reply #5 on: January 09, 2026, 07:39:00 PM »
It looks like it's picking up the emails as they show in the explain log:

FROM (oc_t_user)
WHERE s_email = 'my@email.address'
| 1 |       SIMPLE       |   ...  |Impossible WHERE noticed after reading const tables|



The mailer log shows:
... PHP Warning:  Undefined variable $email in /home/listndso/public_html/oc-includes/osclass/emails.php on line 194 ...


No emails go out for unregistered users; only registered users.


Is anyone else seeing this on their side?

*

MB Themes

Re: Alerts does not send emails to non-members
« Reply #6 on: January 10, 2026, 08:30:08 AM »
Log could be problem, will check it on Monday.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Rob

  • **
  • 7 posts
Re: Alerts does not send emails to non-members
« Reply #7 on: January 11, 2026, 06:00:22 PM »
Here is another possible clue:

Getting the following for each non-member email address.

...
SELECT *
FROM (oc_t_user)
WHERE s_email = 'my@email.address'
--------------------------------------------------
QUERY TIME 0
Error number: 1062
Error description: Duplicate entry '2026-01-11' for key 'PRIMARY'
**************************************************
INSERT INTO oc_t_alerts_sent (d_date, i_num_alerts_sent) VALUES ('2026-01-11', '1')
--------------------------------------------------
...

*

MB Themes

Re: Alerts does not send emails to non-members
« Reply #8 on: January 12, 2026, 10:08:27 AM »
That $email issue you must investigate, is probably just missing variable in those email functions (should be simple to fix).
Main issue is most probably missing pk_i_id on user, so change
Code: [Select]
              $user = array(
                's_name'  => $alert['s_email'],
                's_email' => $alert['s_email']
              );

into:
Code: [Select]
              $user = array(
                'pk_i_id'  => 0,
                's_name'  => $alert['s_email'],
                's_email' => $alert['s_email']
              );

in osclass/alerts.php
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Rob

  • **
  • 7 posts
Re: Alerts does not send emails to non-members
« Reply #9 on: January 12, 2026, 05:56:09 PM »
Thank you!

Looks like that fixed the issue, the emails are going out.

The same errors still show up in the logs after the change.

*

MB Themes

Re: Alerts does not send emails to non-members
« Reply #10 on: January 13, 2026, 09:58:34 AM »
That change is not related to your logs error.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots