i try to pass samples directly over spamd protocolin therory that looks good but log and scan starts after the client closes the conenction or the script exists, as long it tries ot read the response nothing happens at all
without the "fread($socket, 1024);" it terminates immediately, log shows scanning, with the fread() ut take some time, nothing happens on the server side and after a while the script finishes and spamd scans the data
well, the whole purpose is to fread(9 or fgets() the response _______________________________________________un 27 02:05:44 mail-gw spamd[2991]: spamd: checking message <56b9f2a1.6050...@testserver.rhsoft.net> for sa-milt:189 Jun 27 02:05:46 mail-gw spamd[2991]: spamd: identified spam (13.1/5.5) for sa-milt:189 in 12.0 seconds, 1552 bytes. Jun 27 02:05:46 mail-gw spamd[2991]: spamd: result: Y 13 - BAYES_50,CUST_BODY_BEGINS_VL,RAZOR2_CF_RANGE_51_100,RAZOR2_CF_RANGE_E8_51_100,RAZOR2_CHECK,SPF_HELO_FAIL,TVD_SPACE_RATIO,URIBL_DBL_SPAM,URIBL_LOCAL scantime=12.0,size=1552,user=sa-milt,uid=189,required_score=5.5,rhost=localhost,raddr=127.0.0.1,rport=/run/spamassassin/spamassassin.sock,mid=<56b9f2a1.6050...@testserver.rhsoft.net>,bayes=0.498469,autolearn=disabled,shortcircuit=no
_______________________________________________ <?php $socket_path = '/run/spamassassin/spamassassin.sock';echo spamc_headers($socket_path, __DIR__ . '/test1.eml', /**$bayes_only*/0); function spamc_headers($socket_path, $eml_path, $bayes_only=0, $user='sa-milt')
{ $protocol_version = '1.5'; $socket = fsockopen('unix://' . $socket_path, NULL); if($socket) { $raw_eml = trim(file_get_contents($eml_path)) . "\r\n"; $cmd = 'HEADERS SPAMC/' . $protocol_version . "\r\n"; $cmd .= 'Content-Length: ' . strlen($raw_eml) . "\r\n"; $cmd .= 'User: ' . $user . "\r\n"; $cmd .= "\r\n"; $cmd .= $raw_eml; $cmd .= "\r\n"; fwrite($socket, $cmd); echo fread($socket, 1024); } } ?>
signature.asc
Description: OpenPGP digital signature