denc Posted February 16, 2013 Share Posted February 16, 2013 Hi, I have some curiosity.. (1) what does spam_input > spam_outout in the following command line mean? exec('spamassassin spam_input > spam_output'); (2) is it possible for me to find out myself the path of spamassassin? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/274568-spamassassin-not-really-working/ Share on other sites More sharing options...
trq Posted February 16, 2013 Share Posted February 16, 2013 1) It redirects the output of "spamassassin spam_input" into a file called spam_output 2) locate spamassassin Quote Link to comment https://forums.phpfreaks.com/topic/274568-spamassassin-not-really-working/#findComment-1412844 Share on other sites More sharing options...
denc Posted February 17, 2013 Author Share Posted February 17, 2013 spam_input will contain the message sent by visitor. if it will be copied into spam_output, i would expect some content in spam_output? but im seeing that the file is empty all the time. does it mean that spamassassin is not working at all? also i have no acess to execuite unix command, any path where it will usually be located? thanks. Quote Link to comment https://forums.phpfreaks.com/topic/274568-spamassassin-not-really-working/#findComment-1412865 Share on other sites More sharing options...
Christian F. Posted February 17, 2013 Share Posted February 17, 2013 You have PHP don't you, and you're executing spamassasin from it, no..? Quote Link to comment https://forums.phpfreaks.com/topic/274568-spamassassin-not-really-working/#findComment-1412950 Share on other sites More sharing options...
denc Posted February 19, 2013 Author Share Posted February 19, 2013 You have PHP don't you, and you're executing spamassasin from it, no..? Hi Guru, Yes, I'm executing it from a php script. But I'm not getting the correct spam score. It is always giving zero. I'm checking with my webhost, they told me the path to spamassassin is /home/den/.spamassassin, but when I'm checking in that particular directory, only saw these files... bayes_seen, bayes_toks, user_prefs. Is this really the directory then? exec('/home/den/.spamassassin spam_input > spam_output'); $spam_out = file('spam_out'); $score = 5.0; for ($i = 0; $i < count($spam_out); $i++) { if (!(strpos($spam_out[$i], "X-Spam-Status") === FALSE)) { $score = floatval(substr($spam_out[$i], strpos($spam_out[$i], 'score=') + 6)); break; } } In spam_input file, I can see the following From: "denc" <test@test.com> Received: from test.com (test.com [210.195.151.218]) To: email@domain.com Subject: messsage Date: Mon, 18 Feb 2013 23:46:02 EST test message However, this is not copied to spam_output... it is always empty. I'm suspecting the some issue with spamassassin? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/274568-spamassassin-not-really-working/#findComment-1413254 Share on other sites More sharing options...
kicken Posted February 19, 2013 Share Posted February 19, 2013 I'm checking with my webhost, they told me the path to spamassassin is /home/den/.spamassassin, but when I'm checking in that particular directory, only saw these files... bayes_seen, bayes_toks, user_prefs. Is this really the directory then? That is the directory for your user preferences where you can change the configuration settings of spamassassin. You need the location to the spamassassin executable file, which most likely is something like /usr/bin/spamassassin or /usr/local/bin/spamassassin. The following PHP script may be able to locate it for you. If not, ask your host again but make it clear you need the location for the executable, not the preferences. <?php system('which spamassassin'); ?> Stick that in a file, upload it to your site then run it. Quote Link to comment https://forums.phpfreaks.com/topic/274568-spamassassin-not-really-working/#findComment-1413279 Share on other sites More sharing options...
denc Posted February 19, 2013 Author Share Posted February 19, 2013 Hi guru, I have attempted to run the php script provided above, but it is giving empty output. What is this suppose to mean? Quote Link to comment https://forums.phpfreaks.com/topic/274568-spamassassin-not-really-working/#findComment-1413282 Share on other sites More sharing options...
trq Posted February 19, 2013 Share Posted February 19, 2013 You seriously need to get managed hosting. Quote Link to comment https://forums.phpfreaks.com/topic/274568-spamassassin-not-really-working/#findComment-1413302 Share on other sites More sharing options...
denc Posted February 19, 2013 Author Share Posted February 19, 2013 Hi all, I have managed to get the path of spamassassin from my webhost. exec('/usr/local/lib/perl5/site_perl/5.8.8/Mail/SpamAssassin/spamassassin spam_input > spam_output'); $spam_out = file('spam_output'); $score = 0.0; for ($i = 0; $i < count($spam_out); $i++) { if (!(strpos($spam_out[$i], "X-Spam-Status") === FALSE)) { $score = floatval(substr($spam_out[$i], strpos($spam_out[$i], 'score=') + 6)); break; } The same problem im having here. The whole post is in file spam_input as follow From: "denc" <test@test.com> Received: from test.com (test.com [210.195.151.218]) To: email@domain.com Subject: messsage Date: Mon, 18 Feb 2013 23:46:02 EST test message However, it is not being copied to spam_output. When checked, the last changed date of spam_input and spam_output is the same, so I assume there's an attempt to copy content of spam_input to spam_output, however nothing is being copied. Can advise? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/274568-spamassassin-not-really-working/#findComment-1413351 Share on other sites More sharing options...
jazzman1 Posted February 19, 2013 Share Posted February 19, 2013 (edited) Use the "cat" unix command. Let's say that we have only two files - execution.php and spam_input. Execution.php is the file that we want to execute when the php script is running and spam_input is the file which holds the the content that we want to redirect to spam_output. spam_input From: "denc" <test@test.com> Received: from test.com (test.com [210.195.151.218]) To: email@domain.com Subject: messsage Date: Mon, 18 Feb 2013 23:46:02 EST execution.php exec("cat spam_input > spam_output"); After that content has been printed to the new file called spam_output, you can handle it with php. My question is how to get the spam list to the spam_input file? EDIT: If you want to add a new content to the same file without deleting the old one you should use a ">>" symbol. Edited February 19, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/274568-spamassassin-not-really-working/#findComment-1413448 Share on other sites More sharing options...
denc Posted February 20, 2013 Author Share Posted February 20, 2013 Hi there, Thanks, the unix command cat does copy the content to spam_output. Question, normally when spamassassin is executed, it should add in "X-Spam-Status" and the spam score? But, in my case, it doesn't. Already tried to add these to the user_prefs file. add_header all always_add_headers 1 use_bayes 1 required_score 5 score FB_SSEX 10 score HTML_COMMENT_8BITS 3 score OBSCURED_EMAIL 3 score ONLINE_PHARMACY 10 score SUBJ_ILLEGAL_CHARS 3 score UPPERCASE_25_50 3 score UPPERCASE_50_75 3 score UPPERCASE_75_100 3 score VIA_GAP_GRA 3 Can you advise? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/274568-spamassassin-not-really-working/#findComment-1413573 Share on other sites More sharing options...
jazzman1 Posted February 20, 2013 Share Posted February 20, 2013 Question, normally when spamassassin is executed, it should add in "X-Spam-Status" and the spam score?But, in my case, it doesn't. Did you read the documentation how does this mail filter work? Quote Link to comment https://forums.phpfreaks.com/topic/274568-spamassassin-not-really-working/#findComment-1413621 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.