[Evolution] Evolution and Dspam



I am trying to use DSPAM on my mail server. As part of that when the user clicks
on the junk button I want that email to be sent to a specific email address I
have configured.

To accomplish this I have added some code in em-junk-filter.c. The code follows

All the code is trying to do is to write the content to the file.
I have trouble getting the headers out. The code trying to get the DSPAM header
is failing.  Can you tell whether I am doing it right or is there a easier way
to forward the whole message (including headers) to a specific mail address?.

        FILE *ofp;
        char outputFilename[] = "/tmp/dspam_send.txt";
        char *text;

        ofp = fopen(outputFilename, "w");

        if (ofp == NULL) {
          fprintf(stderr, "Can't open output file %s!\n", outputFilename);
          exit(1);
        }

     //////////////////////////////////////////////////////////////////////
        const char *header;
        header = (const char *)camel_medium_get_header (CAMEL_MEDIUM (msg),
"X-DSPAM-Signature");

        if (header)
          fprintf(ofp, "X-DSPAM-Signature:%s\n", header);
        else
           fprintf(ofp, "Not found\n");

     //////////////////////////////////////////////////////////////////////     

        text = camel_mime_message_get_subject (msg);
        fprintf(ofp, "%s", text);
        fclose(ofp);
        system("cat /tmp/dspam_send.txt|mailmail xyz domain com");


Thanks in advance,
-Prasanth.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]