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


Reply via email to