Hi!
I have a windows server 2008 with a mail server installed. For every emails that comes in, a C# application is launched that pipes the message through a set of optional filters and then decides whether or not to let it throught.
I have alrealdy a couple of "homemade" filters implemented but I would like to add one to take advantage of SpamAssassin's power. Since SA is UNIX based, I'm working with its window port (SAWin32). When I launch SpammAssassin directly from command line, email gets analysed correctly:
spamassassin.exe -L -e < C:\SPAM.MAI
(-L enables only local test, -e exits with a non zero value if the tested message was spam)
But when I try to launch it from my C# application, it doesn't seem to work since the return value is always equal to 2 (even for ham messages):
Process proc = new Process();
proc.StartInfo.FileName = @"C:\spamassassin.exe";
proc.StartInfo.Arguments = " -L -e < C:\SPAM.MAI";
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
proc.Start();
proc.WaitForExit();
int exitCode = proc.ExitCode;
Console.WriteLine("Exit code: " + exitCode);
proc.Close();
I would like to know if there is something wrong with my code and/or if anyone has experience launching SAWin32 from a C# console application?
Thanks a lot!