Re: SpamAssassin Integration

2010-06-18 Thread Gnanam


Martin Gregorie-2 wrote:
 
 How are you assembling the message? About the best you can do is to grab
 it as a text string when the message is ready to be sent to the mail
 server. At thius point it should contain the headers your program has
 added and the assembled MIME format body, The string can then be written
 to spamc's stdin and its output read from stdout. Run spamc with the -R
 option: this will cause it to output a formatted report about the
 message preceeded with a line reading n/m (n=score, m=spam threshhold).
 
 If your mail client is written in Java you're probably using JavaMail.
 In this case the message will probably have been assembled in a
 MimeMessage object. When that's complete, i.e. just before you call the
 Transport.send() method to send the message, call
 MimeMessage.writeTo(OutputStream) and copy everything read from the
 OutputStream to spamc's stdin as described above.
 

Hi Martin,

Your recommended/suggested solution of assembly message exactly meets my use
case requirement. Thanks for letting me know the existence of the method
MimeMessage.writeTo(OutputStream).  That's great!  Thanks once again for
that valuable solution.

Regards,
Gnanam
-- 
View this message in context: 
http://old.nabble.com/SpamAssassin-Integration-tp28903365p28922585.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.



Re: SpamAssassin Integration

2010-06-17 Thread Gnanam


Jari Fredriksson wrote:
 
 
 You need to prepare a valid looking email message from the text the web
 app produces. It needs all the required headers before the actual body
 of text to work. You may need to study SMTP RFC's to get it right, the
 simple looking headers like Date: and Received: need to be carefully
 crafted after the standards.
 
 The just use ProcessBuilder in your Java app to connect to spamc and
 pass the message for it, and read the results.
 
 -- 
 http://www.iki.fi/jarif/
 I use PGP. If there is an incompatibility problem with your mail
 client, please contact me.
 

Is it not possible to test spam score for only the email content part of
the email message with SpamAssassin? That means, I just want to test spam
score of .html, .txt file extension types only.

In case if I want to prepare a valid looking email message, as you had
suggested, with simple looking headers, etc., can you share me relevant
documentation links on the same?

BTW, what does PGP mean that I found from your signature?
-- 
View this message in context: 
http://old.nabble.com/SpamAssassin-Integration-tp28903365p28910744.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.



Re: SpamAssassin Integration

2010-06-17 Thread Gnanam


Frank Heydlauf-2 wrote:
 
 Would this really help? 
 Could you tell us a bit more about your problem itself?
 
 The reason I ask is: the mailbody is a very small part of what is
 commonly used for antispam measures. Header is added afterwards,
 IP is not yet known, HELO is not known, no reputation, no RBLs, no
 phyzor/razor/...  
 It's not easy to get a SA score 5 if anything else is OK (IP
 reputation/RBLs, DNS, Header, HELO, ...) - just try yourself
 (spamassassin -t testmail).
 So - in my eyes - body-testing will give you little benefit - at
 least as long you are not developing a spam toolkit.
 

More about my problem: Recently our application Users have started
complaining that mails sent from our application are reaching recipient's
Junk E-mail folder instead of Inbox.  That is rate of false positives is
high.  We've also verified other anti-spam measures from our side like
whether our server IP address is blacklisted with any anti-spam websites
(Spamhaus, SORBS, etc.) but it was not the case.  Then we found that least
we can do from application context is by allowing Users to test spam score
of their email content before they actuall send emails.

I agree with you that mailbody is one of the part of what is commonly used
for antispam measures but still we want to advise/allow our application
Users to test spam score of their email body/content.  Reason I'm saying
this is that since the entire email body/content is composed by Users,
atleast by running spam score test, spam triggering properties within email
content can be avoided.  Hope this clarifies the situation.

Can SpamAssassin be used to test spam score of .html, .txt file extension
types, that is email body/content part of the email message?
-- 
View this message in context: 
http://old.nabble.com/SpamAssassin-Integration-tp28903365p28911147.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.



Re: SpamAssassin Integration

2010-06-17 Thread Frank Heydlauf
On Thu, Jun 17, 2010 at 12:17:10AM -0700, Gnanam wrote:

 Can SpamAssassin be used to test spam score of .html, .txt file extension
 types, that is email body/content part of the email message?

that will not give you the output you'd expect.
Just create a complete mail with header and mime-encoded multipart etc
and feed this into SA.

btw: http://lmgtfy.com/?q=PGP
-- 
Regards
Frank


Re: SpamAssassin Integration

2010-06-17 Thread Gnanam


Frank Heydlauf-2 wrote:
 
 that will not give you the output you'd expect.
 Just create a complete mail with header and mime-encoded multipart etc
 and feed this into SA.
 

How do I create a complete mail with header, etc.?  Is there any
standard/rule for creating a complete email message that is compliant with
SA?  Relevant links, documentation, etc. for the same are appreciated?
-- 
View this message in context: 
http://old.nabble.com/SpamAssassin-Integration-tp28903365p28913486.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.



Re: SpamAssassin Integration

2010-06-17 Thread Matus UHLAR - fantomas
 Frank Heydlauf-2 wrote:
  
  that will not give you the output you'd expect.
  Just create a complete mail with header and mime-encoded multipart etc
  and feed this into SA.

On 17.06.10 05:02, Gnanam wrote:
 How do I create a complete mail with header, etc.?  Is there any
 standard/rule for creating a complete email message that is compliant with
 SA?  Relevant links, documentation, etc. for the same are appreciated?

very hardly. It would be nice if the server SW showed how it came to
conclution that the mails are spammy...
-- 
Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Where do you want to go to die? [Microsoft]


Re: SpamAssassin Integration

2010-06-17 Thread Matt Kettler
On 6/17/2010 8:02 AM, Gnanam wrote:

 Frank Heydlauf-2 wrote:
   
 that will not give you the output you'd expect.
 Just create a complete mail with header and mime-encoded multipart etc
 and feed this into SA.

 
 How do I create a complete mail with header, etc.?  Is there any
 standard/rule for creating a complete email message that is compliant with
 SA?  Relevant links, documentation, etc. for the same are appreciated?
   

The best docs would be the RFC standards:

RFC 2822 Internet Message Format
RFC 822 (obsoleted by above, but sometimes useful for understanding the
history of the format, making intent clearer.)


Re: SpamAssassin Integration

2010-06-17 Thread Martin Gregorie
On Thu, 2010-06-17 at 05:02 -0700, Gnanam wrote:
 
 Frank Heydlauf-2 wrote:
  
  that will not give you the output you'd expect.
  Just create a complete mail with header and mime-encoded multipart etc
  and feed this into SA.
  
 
 How do I create a complete mail with header, etc.?  Is there any
 standard/rule for creating a complete email message that is compliant with
 SA?  Relevant links, documentation, etc. for the same are appreciated?

How are you assembling the message? About the best you can do is to grab
it as a text string when the message is ready to be sent to the mail
server. At thius point it should contain the headers your program has
added and the assembled MIME format body, The string can then be written
to spamc's stdin and its output read from stdout. Run spamc with the -R
option: this will cause it to output a formatted report about the
message preceeded with a line reading n/m (n=score, m=spam threshhold).

If your mail client is written in Java you're probably using JavaMail.
In this case the message will probably have been assembled in a
MimeMessage object. When that's complete, i.e. just before you call the
Transport.send() method to send the message, call
MimeMessage.writeTo(OutputStream) and copy everything read from the
OutputStream to spamc's stdin as described above.


Martin




Re: SpamAssassin Integration

2010-06-17 Thread SM

At 05:18 17-06-10, Matt Kettler wrote:

The best docs would be the RFC standards:

RFC 2822 Internet Message Format
RFC 822 (obsoleted by above, but sometimes useful for understanding the
history of the format, making intent clearer.)


RFC 2822 obsoleted by RFC 5322.

Regards,
-sm 



Re: SpamAssassin Integration

2010-06-17 Thread Jari Fredriksson
On 17.6.2010 9:19, Gnanam wrote:
 
 
 BTW, what does PGP mean that I found from your signature?

http://en.wikipedia.org/wiki/Pretty_Good_Privacy



-- 
http://www.iki.fi/jarif/
I use PGP. If there is an incompatibility problem with your mail
client, please contact me.

O, it is excellent
To have a giant's strength; but it is tyrannous
To use it like a giant.
-- Shakespeare, Measure for Measure, II, 2



signature.asc
Description: OpenPGP digital signature


Re: SpamAssassin Integration

2010-06-16 Thread Jari Fredriksson
On 16.6.2010 17:18, Gnanam wrote:
 
 Hi,
 
 I want to integrate SpamAssassin in my web-based application to test spam
 score of the email content that our application User's wish to send in
 mail composing page itself - even before sending.  When I say mail composing
 page here, it is not an email client like Outlook, Outlook Express, etc. but
 rather it is a regular/normal web-based form with HTML editor.
 
 How do I integrate SpamAssassin for my Use Case explained above?  Relevant
 documentation links on the same are appreciated.
 

You need to prepare a valid looking email message from the text the web
app produces. It needs all the required headers before the actual body
of text to work. You may need to study SMTP RFC's to get it right, the
simple looking headers like Date: and Received: need to be carefully
crafted after the standards.

The just use ProcessBuilder in your Java app to connect to spamc and
pass the message for it, and read the results.

-- 
http://www.iki.fi/jarif/
I use PGP. If there is an incompatibility problem with your mail
client, please contact me.

Exercise caution in your daily affairs.



signature.asc
Description: OpenPGP digital signature


Re: SpamAssassin Integration

2010-06-16 Thread Charles Gregory

On Wed, 16 Jun 2010, Gnanam wrote:

I want to integrate SpamAssassin in my web-based application to test spam
score of the email content...


If this is your own custom web software, then it is as simple as adding a 
call to spamassassin (or spamc) in the same area of the script that 
validates things like the format of e-mail addresses. You can keep it 
simple and just report spamassassin's exit code, or you could parse the 
results from SA and pass them back to your user, so that they know what 
rules were triggered, and how to correct their e-mail.


If your web interface is pre-packaged piece of software, then it likely 
sends mail via your local SMTP server by calling 'sendmail' or an 
equivalent function that mimics that command. As long as the web client 
handles SMTP rejections and notifies users of problems sending, you 
should be able to run spamassassin normally in the context of your 
outgoing mail server.


- Charles


Re: SpamAssassin Integration

2010-06-16 Thread Frank Heydlauf
Hi,

On Wed, Jun 16, 2010 at 07:18:57AM -0700, Gnanam wrote:
 
 I want to integrate SpamAssassin in my web-based application to test spam
 score of the email content that our application User's wish to send in
 mail composing page itself - even before sending.  When I say mail composing
 page here, it is not an email client like Outlook, Outlook Express, etc. but
 rather it is a regular/normal web-based form with HTML editor.

Would this really help? 
Could you tell us a bit more about your problem itself?

The reason I ask is: the mailbody is a very small part of what is
commonly used for antispam measures. Header is added afterwards,
IP is not yet known, HELO is not known, no reputation, no RBLs, no
phyzor/razor/...  
It's not easy to get a SA score 5 if anything else is OK (IP
reputation/RBLs, DNS, Header, HELO, ...) - just try yourself
(spamassassin -t testmail).
So - in my eyes - body-testing will give you little benefit - at
least as long you are not developing a spam toolkit.

-- 
Regards
Frank


Re: SpamAssassin Integration

2010-06-16 Thread Gnanam


If this is your own custom web software, then it is as simple as adding a 
 call to spamassassin (or spamc) in the same area of the script that 
 validates things like the format of e-mail addresses.

I want to do spam score test for only the email content part of the email
message.  In that case, is it possible to call spamassassin or spamc?  Based
on spamc documentation here
http://spamassassin.apache.org/full/3.1.x/doc/spamc.html, it accepts only
email message as it command-line argument.  Is it possible to pass .html,
.txt extension file types, since I want to get spam score of the email
content part only and not the entire email message itself?



 If your web interface is pre-packaged piece of software, then it likely 
 sends mail via your local SMTP server by calling 'sendmail' or an 
 equivalent function that mimics that command. As long as the web client 
 handles SMTP rejections and notifies users of problems sending, you 
 should be able to run spamassassin normally in the context of your 
 outgoing mail server.
Mine is our own custom web software except that we've signed-up with a
third-party SMTP service provider to send emails, so this SMTP server is
completely managed and maintained by this third-party.  Yes, as you rightly
said, spamassassin is already running/integrated with this third-party SMTP
mail service provider.  What we want to achieve in our application is that
before actually sending mails, Users themselves can run spam score test on
one portion of their email message, that is their email content part.
-- 
View this message in context: 
http://old.nabble.com/SpamAssassin-Integration-tp28903365p28910672.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.