email reports are not being send

General eFa discussion
Post Reply
ckruijntjens
Posts: 9
Joined: 24 Feb 2017 12:54

email reports are not being send

Post by ckruijntjens »

Hello,

Sind the upgrade to efa 3.0.2.2 (vm) email reports are not being send. When i do it manualy i get following error:

=== Generating report for type=A
==== Recipient e-mail address is
==== Building list for
==== Found 0 quarantined e-mails
PHP Notice: Undefined variable: sendResult in /var/www/html/mailscanner/quarantine_report.inc.php on line 373

Notice: Undefined variable: sendResult in /var/www/html/mailscanner/quarantine_report.inc.php on line 373

Anybody knows how to resolve this?
User avatar
shawniverson
Posts: 3644
Joined: 13 Jan 2014 23:30
Location: Indianapolis, Indiana USA
Contact:

Re: email reports are not being send

Post by shawniverson »

MailWatch is such a moving target :?

I'll take a look at this, probably will need to release another MailWatch update for this as well...
ckruijntjens
Posts: 9
Joined: 24 Feb 2017 12:54

Re: email reports are not being send

Post by ckruijntjens »

Hi,

Thank you for your reply and work!

Chris Kruijntjens.
r31griffo
Posts: 19
Joined: 31 Mar 2017 05:09

Re: email reports are not being send

Post by r31griffo »

Same error here (new install).

When I run it manually, I get the following error (there's a little more detail when the user has spam):

Code: Select all

 === Generating report for stest@mydomain.com type=U
 ==== Recipient e-mail address is stest@mydomain.com
 ==== Building list for stest@mydomain.com
 ==== Found 4 quarantined e-mails
 ==== ERROR sending e-mail to stest@mydomain.com Failed to add recipient: stest@mydomain.com [SMTP: Invalid response code received from server (code: 450, response: 4.1.8 <postmaster@domain.tld>: Sender address rejected: Domain not found)]
PHP Notice:  Undefined variable: sendResult in /var/www/html/mailscanner/quarantine_report.inc.php on line 368

Notice: Undefined variable: sendResult in /var/www/html/mailscanner/quarantine_report.inc.php on line 368
I've previously set the postmaster address, in the error it shows what I'm guessing is the default one...I'm trying to figure it out now, anyone else had any luck?
r31griffo
Posts: 19
Joined: 31 Mar 2017 05:09

Re: email reports are not being send

Post by r31griffo »

A little more info on this...I've managed to manually send the report by running:
/usr/local/bin/mailwatch/tools/Cron_jobs/mailwatch_quarantine_report.php
I suspect the cronjob will kick in from now on.


The problem appeared to be at line: 4326 of /var/www/html/mailscanner/functions.php
The sender address doesn't appear to be set:
$sender = QUARANTINE_REPORT_FROM_NAME . ' <' . MAILWATCH_FROM_ADDR . '>';

MAILWATCH_FROM_ADDR is defined at line: 164 of /var/www/html/mailscanner/conf.php
I replaced postmaster@domain.ltd with the sender address I wanted to use and voila!

I'm still getting another error when manually running the report but I believe it's benign, I suspect sendResult is just a success/fail notification.
c0mputerking
Posts: 29
Joined: 26 Aug 2014 23:47

Re: email reports are not being send

Post by c0mputerking »

I have always had problems with reports and have never actually received one

[root@efa-1 ~]# /usr/local/bin/mailwatch/tools/Cron_jobs/mailwatch_quarantine_report.php

=== Generating report for User type=A
==== Recipient e-mail address is admin@user.ca
==== Building list for User
PHP Fatal error: Uncaught exception 'mysqli_sql_exception' with message 'Unknown column 'a.token' in 'field list'' in /var/www/html/mailscanner/functions.php:999
Stack trace:
#0 /var/www/html/mailscanner/functions.php(999): mysqli->query('?SELECT DISTINC...')
#1 /var/www/html/mailscanner/quarantine_report.inc.php(443): dbquery('?SELECT DISTINC...')
#2 /var/www/html/mailscanner/quarantine_report.inc.php(360): Quarantine_Report::return_quarantine_list_array('User', 'User')
#3 /var/www/html/mailscanner/quarantine_report.inc.php(317): Quarantine_Report::send_reports_for_user('User', 'A', 'admin@User...', 'User', 'User')
#4 /usr/local/bin/mailwatch/tools/Cron_jobs/mailwatch_quarantine_report.php(50): Quarantine_Report->send_quarantine_reports(Array)
#5 {main}
thrown in /var/www/html/mailscanner/functions.php on line 999

Fatal error: Uncaught exception 'mysqli_sql_exception' with message 'Unknown column 'a.token' in 'field list'' in /var/www/html/mailscanner/functions.php:999
Stack trace:
#0 /var/www/html/mailscanner/functions.php(999): mysqli->query('?SELECT DISTINC...')
#1 /var/www/html/mailscanner/quarantine_report.inc.php(443): dbquery('?SELECT DISTINC...')
#2 /var/www/html/mailscanner/quarantine_report.inc.php(360): Quarantine_Report::return_quarantine_list_array('User', 'User')
#3 /var/www/html/mailscanner/quarantine_report.inc.php(317): Quarantine_Report::send_reports_for_user('User', 'A', 'admin@user...', 'User', 'User')
#4 /usr/local/bin/mailwatch/tools/Cron_jobs/mailwatch_quarantine_report.php(50): Quarantine_Report->send_quarantine_reports(Array)
#5 {main}
thrown in /var/www/html/mailscanner/functions.php on line 999
User avatar
shawniverson
Posts: 3644
Joined: 13 Jan 2014 23:30
Location: Indianapolis, Indiana USA
Contact:

Re: email reports are not being send

Post by shawniverson »

It appears that the token field is missing from your database for some reason. You might try rerunning the MailWatch upgrade.php here to ensure that field does exist.

Code: Select all

wget https://raw.githubusercontent.com/mailwatch/MailWatch/develop/upgrade.php
sudo /usr/bin/php ./upgrade.php
c0mputerking
Posts: 29
Joined: 26 Aug 2014 23:47

Re: email reports are not being send

Post by c0mputerking »

Ok i ran the database upgrade see below seems some warnings and something near the end about maillog not sure if that is supposed to be there?

However i think i am getting a new error now when running the command manually now missing quarantine_report.inc

[root@efa-1 ~]# /usr/local/bin/mailwatch/tools/Cron_jobs/mailwatch_quarantine_report.php

=== Generating report for admin@mx1.computerking.ca type=U
==== Recipient e-mail address is admin@mx1.computerking.ca
==== Building list for admin@mx1.computerking.ca
==== Found 0 quarantined e-mails
==== Building list for admin@canmail.org
==== Found 0 quarantined e-mails
==== Building list for graeme-akismet@canmail.org
==== Found 0 quarantined e-mails
==== Building list for postmaster@mx1.computerking.ca
==== Found 0 quarantined e-mails
==== Building list for postmaster@canmail.org
==== Found 0 quarantined e-mails
PHP Notice: Undefined variable: sendResult in /var/www/html/mailscanner/quarantine_report.inc
.php on line 373

Notice: Undefined variable: sendResult in /var/www/html/mailscanner/quarantine_report.inc.php
on line 373

=== Generating report for c0mputerking type=A
==== Recipient e-mail address is admin@computerking.ca
==== Building list for c0mputerking
==== Found 0 quarantined e-mails
PHP Notice: Undefined variable: sendResult in /var/www/html/mailscanner/quarantine_report.inc
.php on line 373

Notice: Undefined variable: sendResult in /var/www/html/mailscanner/quarantine_report.inc.php
on line 373



[root@efa-1 ~]# sudo /usr/bin/php ./upgrade.php

MailWatch for MailScanner Database Upgrade to 1.2.3-dev

Have you done a full backup of your database? Type 'yes' to continue: no
ABORTING!
[root@efa-1 ~]# sudo /usr/bin/php ./upgrade.php

MailWatch for MailScanner Database Upgrade to 1.2.3-dev

Have you done a full backup of your database? Type 'yes' to continue: yes

Testing connectivity to the database ................................. OK

Updating database schema:

- Convert database to utf8........................................... OK

- Drop `geoip_country` table......................................... ALREADY DROPPED
- Drop `spamscores` table............................................ OK
- Add autorelease table to `mailscanner` database.................... ALREADY EXIST
- Add resetid, resetexpire and lastreset fields in `users` table..... OK

- Fix schema for username field in `audit_log` table................. OK
- Fix schema for id field in `blacklist` table....................... OK
- Fix schema for username field in `users` table..................... OK
- Fix schema for spamscore field in `users` table.................... OK
- Fix schema for highspamscore field in `users` table................ OK
- Fix schema for username field in `user_filters` table.............. OK
- Fix schema for username field in `whitelist` table................. OK
- Fix schema for username field in `audit_log` table................. OK
- Fix schema for password field in `users` table..................... OK
- Fix schema for fullname field in `users` table..................... OK
- Fix schema for rule_desc field in `mcp_rules` table................ OK

- Cleanup orphaned user_filters...................................... OK
- Add id field and primary key to `audit_log` table.................. OK
- Add inq_id field and primary key to `inq` table.................... OK
- Add maillog_id field and primary key to `maillog` table............ OK
- Add rblspamreport field to `maillog` table......................... OK
- Add token field to `maillog` table................................. OK
- Check for missing tokens in `maillog` table........................ DONE
1351 token generated
- Add mtalog_id field and primary key to `mtalog` table.............. OK
- Add mtalog_id field and primary key to `outq` table................ OK
- Add id field and primary key to `saved_filters` table.............. OK
- Add mtalog_id field and primary key to `user_filters` table........ OK

- Dropping too big index `maillog_from_idx` on table `maillog`....... OK
- Dropping too big index `maillog_to_idx` on table `maillog`......... OK

- Convert database to utf8mb4........................................ OK

- Convert table `audit_log` to utf8mb4............................... OK
- Convert table `autorelease` to utf8mb4............................. OK
- Convert table `blacklist` to utf8mb4............................... OK
- Convert table `inq` to utf8mb4..................................... OK
- Convert table `maillog` to utf8mb4................................. OK
- Convert table `mcp_rules` to utf8mb4............................... OK
- Convert table `mtalog` to utf8mb4.................................. OK
- Convert table `mtalog_ids` to utf8mb4.............................. OK
- Convert table `outq` to utf8mb4.................................... OK
- Convert table `saved_filters` to utf8mb4........................... OK
- Convert table `sa_rules` to utf8mb4................................ OK
- Convert table `users` to utf8mb4................................... OK
- Convert table `user_filters` to utf8mb4............................ OK
- Convert table `whitelist` to utf8mb4............................... OK

- Convert table `audit_log` to InnoDB................................ OK
- Convert table `autorelease` to InnoDB.............................. OK
- Convert table `blacklist` to InnoDB................................ OK
- Convert table `inq` to InnoDB...................................... OK
- Convert table `maillog` to InnoDB.................................. OK
- Convert table `mcp_rules` to InnoDB................................ OK
- Convert table `mtalog` to InnoDB................................... OK
- Convert table `mtalog_ids` to InnoDB............................... OK
- Convert table `outq` to InnoDB..................................... OK
- Convert table `saved_filters` to InnoDB............................ OK
- Convert table `sa_rules` to InnoDB................................. OK
- Convert table `users` to InnoDB.................................... OK
- Convert table `user_filters` to InnoDB............................. OK
- Convert table `whitelist` to InnoDB................................ OK

- Search for missing indexes on table `maillog`...................... DONE
- Adding missing index `maillog_from_idx` on table `maillog`......... OK
- Adding missing index `maillog_to_idx` on table `maillog`........... OK
- Adding missing index `timestamp_idx` on table `maillog`............ OK
- Adding missing index `subject_idx` on table `maillog`.............. WARNING

Checking MailScanner.conf settings:

- QuarantineWholeMessage ............................................ OK
- QuarantineWholeMessagesAsQueueFiles ............................... OK
- DetailedSpamReport ................................................ OK
- IncludeScoresInSpamAssassinReport ................................. OK
- SpamActions ....................................................... OK
- HighScoringSpamActions ............................................ OK
- AlwaysLookedUpLast ................................................ OK

Checking conf.php configuration entry:

- All mandatory entries are present.................................. OK
- All obsolete entries are already removed........................... OK
- optional RPC_PORT ................................................. WARNING
- optional RPC_SSL .................................................. WARNING
- optional RPC_REMOTE_SERVER ........................................ WARNING
- optional LDAP_BIND_PREFIX ......................................... WARNING
- optional LDAP_BIND_SUFFIX ......................................... WARNING
- optional EXIM_QUEUE_IN ............................................ WARNING
- optional EXIM_QUEUE_OUT ........................................... WARNING
- optional PWD_RESET_FROM_NAME ...................................... WARNING
- optional PWD_RESET_FROM_ADDRESS ................................... WARNING
- optional MAIL_SENDER .............................................. WARNING
- optional SESSION_NAME ............................................. WARNING
- optional USER_SELECTABLE_LANG ..................................... WARNING

*** ERROR/WARNING SUMMARY ***
Table Index: MySQL version unsupported for index `subject_idx` on table `maillog`, upgrade to
version >= 50604 (you have version 50505)
conf.php: optional configuration entry "RPC_PORT" is missing, needed if RPC_ONLY mode is enabl
ed
conf.php: optional configuration entry "RPC_SSL" is missing, needed if RPC_ONLY mode is enable
d
conf.php: optional configuration entry "RPC_REMOTE_SERVER" is missing, needed to show number o
f mails in postfix queues on remote server (RPC)
conf.php: optional configuration entry "LDAP_BIND_PREFIX" is missing, needed when using LDAP a
uthentication
conf.php: optional configuration entry "LDAP_BIND_SUFFIX" is missing, needed when using LDAP a
uthentication
conf.php: optional configuration entry "EXIM_QUEUE_IN" is missing, needed only if using Exim a
s MTA
conf.php: optional configuration entry "EXIM_QUEUE_OUT" is missing, needed only if using Exim
as MTA
conf.php: optional configuration entry "PWD_RESET_FROM_NAME" is missing, needed if Password Re
set feature is enabled
conf.php: optional configuration entry "PWD_RESET_FROM_ADDRESS" is missing, needed if Password
Reset feature is enabled
conf.php: optional configuration entry "MAIL_SENDER" is missing, needed if you use Exim or Sen
dmail Queue
conf.php: optional configuration entry "SESSION_NAME" is missing, needed if experiencing sessi
on conflicts
conf.php: optional configuration entry "USER_SELECTABLE_LANG" is missing, comma separated list
of codes for languages the users can use eg. "de,en,fr,it,nl,pt_br"
User avatar
shawniverson
Posts: 3644
Joined: 13 Jan 2014 23:30
Location: Indianapolis, Indiana USA
Contact:

Re: email reports are not being send

Post by shawniverson »

Ok, that actually looks better. I think we have a bug here. I'm working on another iteration of MailWatch that contains some more fixes, one specifically for quarantine reports.
c0mputerking
Posts: 29
Joined: 26 Aug 2014 23:47

Re: email reports are not being send

Post by c0mputerking »

Ok looking forward to that fix :)
Post Reply