Hi all,
Just wondering if anyone has done this before or something like it and might be able to give me a nudge in the right direction.
Basically a tool I'm working with has the ability to generate news letters to users. The client wants the system to use the installed spamassassin to check the message before it is sent and feedback the results, both scoring and a break down of what is generating the score.
I would need to pass the HTML and Plaintext parts of a multipart email along with Subject and From details.
It's a dedicated box and can have additional libs installed if needed.
Any ideas?
Integrating Spamassassin check with form in page
Moderator: General Moderators
SOLVED Re: Integrating Spamassassin check with form in page
Updating this myself as I have managed to sort it out and it might prove useful to someone else
Make sure you have a copy of Spam Assassin installed on the box in question. You may want to install it to a user account if you already use a current installation for check email so that the learning engine is no polluted with the checks from the CMS / PHP Submission.
Start the spamd daemon.
from Linux command line
Then you can use this PHP code to test the email. Using man spamc from the prompt you can see the other options available, I choose full reporting for my system
This outputs an array similar to ::
Excuse the content, I was testing certain messages ^^
Make sure you have a copy of Spam Assassin installed on the box in question. You may want to install it to a user account if you already use a current installation for check email so that the learning engine is no polluted with the checks from the CMS / PHP Submission.
Start the spamd daemon.
Code: Select all
/usr/bin/spamd -d
Then you can use this PHP code to test the email. Using man spamc from the prompt you can see the other options available, I choose full reporting for my system
Code: Select all
<?php
$headers = file_get_contents('/home/me/sa-tests/default-headers.eml');
$content = file_get_contents('/home/me/sa-tests/content.eml');
$fname = tempnam("/home/me/sa-tests", "sa");
$message = $headers . "\n" . $content;
file_put_contents($fname, $message);
exec("/usr/bin/spamc -R < $fname", $res);
print_r($res);
echo "\n";
unlink($fname);
?>
Code: Select all
Array
(
[0] => 0.6/5.0
[1] => Spam detection software, running on the system "domain.int", has
[2] => identified this incoming email as possible spam. The original message
[3] => has been attached to this so you can view it (if it isn't spam) or label
[4] => similar future email. If you have any questions, see
[5] => the administrator of that system for details.
[6] =>
[7] => Content preview: You have received a rich content email created using Vismail.
[8] => To view, please paste this link into your browser:
[9] =>
[10] =>
[11] => Content analysis details: (0.6 points, 5.0 required)
[12] =>
[13] => pts rule name description
[14] => ---- ---------------------- --------------------------------------------------
[15] => 0.0 MISSING_MID Missing Message-Id: header
[16] => -0.0 NO_RELAYS Informational: message was not relayed via SMTP
[17] => 0.0 NORMAL_HTTP_TO_IP URI: Uses a dotted-decimal IP address in URL
[18] => 0.0 HTML_MESSAGE BODY: HTML included in message
[19] => 0.6 DRUGS_ERECTILE Refers to an erectile drug
[20] => -0.0 NO_RECEIVED Informational: message has no Received headers
[21] =>
)
Re: Integrating Spamassassin check with form in page
Interesting idea. *nicks it* 
-
rajendiran
- Forum Newbie
- Posts: 1
- Joined: Thu Feb 26, 2009 5:08 am
Re: Integrating Spamassassin check with form in page
hi Mr.Kadanis
really u have done a great job...
i want this result to be processed to display in table using different color for different values...
and the heading as points rule name and description
as shown in the figure

please put your suggestions
thanks
Rajendiran A
really u have done a great job...
i want this result to be processed to display in table using different color for different values...
and the heading as points rule name and description
as shown in the figure

please put your suggestions
thanks
Rajendiran A