On Tue, Jul 05, 2005 at 01:43:22PM +0300, Sergey Poznyakoff wrote:
> I should have payed more attention:
> 
> > redirect: 1: cannot get envelope sender: Requested item not found
> 
> Your sample script did not contain "redirect", action. That's why I was
> unable to reproduce the error. 
> 
> > As you can see the message does not begin with a "From " in the first
> > line. Is this how the envelope_sender() determines the envelope?
> 
> No, it does not use it, since maildir messages never contain this line.
> It is looking for X-Envelope-Sender, which your sample message does not
> contain, indeed. It should be easy to fix, I'll get back to you later on
> this subject.
>

I will test your patch and let you know (always in the 20050623
snapshot) 
 
> However, I still cannot reproduce 'Function not implemented' error...
> 

This happens in the standard Debian packages (no snapshot or aplha
release) 
Here are the details of my system:

Debian GNU/Linux Sarge, kernel 2.6.8-2-686
Standard Debian packages of mailutils, specifically
[EMAIL PROTECTED](1)[02:44 PM]~/WorkingArea/trunk/mda>dpkg -l | grep mailutils
ii  libmailutils0               0.6.1-4                     GNU Mail 
abstraction library
ii  libmailutils0-dev           0.6.1-4                     Development files 
for GNU mailutils
ii  mailutils                   0.6.1-4                     GNU mailutils 
utilities for handling mail
ii  mailutils-comsatd           0.6.1-4                     GNU mailutils-based 
comsatd daemon
ii  mailutils-doc               0.6.1-4                     Documentation for 
GNU mailutils
ii  mailutils-imap4d            0.6.1-4                     GNU mailutils-based 
IMAP4 Daemon
ii  mailutils-mh                0.6.1-4                     GNU mailutils-based 
MH utilities
ii  mailutils-pop3d             0.6.1-4                     GNU mailutils-based 
POP3 Daemon

I include my test program, my makefile and the filters file. I run it using a
Maildir mailbox like

MU_DEBUG=1 ./testsieve file:/home/kzorba/Maildir filters.sieve  

Relevant output:

...
Sergey Poznyakoff <[EMAIL PROTECTED]>     Re: [bug-mailutils] Mailbox locking 
(especially over NFS) questions
mbox_open (/home/kzorba/WorkingArea/trunk/mda/test.sergey, 0x12)
mbox_append_message (/home/kzorba/WorkingArea/trunk/mda/test.sergey)
mailbox_append_message (test.sergey) failed: Function not implemented
mbox_close (/home/kzorba/WorkingArea/trunk/mda/test.sergey)
mbox_destroy (/home/kzorba/WorkingArea/trunk/mda/test.sergey)
fileinto: cannot save to mailbox: Function not implemented
Sergey Poznyakoff <[EMAIL PROTECTED]>     Re: [bug-mailutils] Error in redirect 
sieve action [SOLVED]
mbox_open (/home/kzorba/WorkingArea/trunk/mda/test.sergey, 0x12)
mbox_append_message (/home/kzorba/WorkingArea/trunk/mda/test.sergey)
mailbox_append_message (test.sergey) failed: Function not implemented
mbox_close (/home/kzorba/WorkingArea/trunk/mda/test.sergey)
mbox_destroy (/home/kzorba/WorkingArea/trunk/mda/test.sergey)
fileinto: cannot save to mailbox: Function not implemented
...


> Regards,
> Sergey
> 

Thanks,
Kostas

-- 
  Kostas Zorbadelos
  Systems Designer/Developer, Otenet SA 
  [EMAIL PROTECTED] contact: kzorba (at) otenet.gr
  
  Out there in the darkness, out there in the night
  out there in the starlight, one soul burns brighter
  than a thousand suns.

/*------------------------------------------------------------------
 * testsieve.c
 * This program tests the functionality of the mailutils libraries,
 * specifically libmailbox and libsieve.
 *
 * The program expects as input a mailbox location and a file containing
 * a sieve script. It reads and runs the sieve script for each message of 
 * the mailbox in turn.
 ------------------------------------------------------------------*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include <mailutils/mailutils.h>

#define MU_DEBUG_LEVEL (MU_DEBUG_ERROR|MU_DEBUG_TRACE|MU_DEBUG_PROT|MU_SIEVE_DEBUG_TRACE)
#define SIEVE_DEBUG_LEVEL 0

int main(int argc, char* argv[]) {

  char *from;
  char *subject;
  mailbox_t mbox;
  size_t msgno, total = 0;
  int status;
  sieve_machine_t mach;
  mu_debug_t debug = NULL;


  /* Register the formats. */
  /* This supports mbox, maildir and mh */ 
  mu_register_local_mbox_formats();
  /*  mu_register_all_mbox_formats ();  */
  /* Register the mailer formats */
  mu_register_all_mailer_formats();

  /* Create the instance of the sieve machine */
  status = sieve_machine_init(&mach,NULL);
  if (status !=0) {
    mu_error ("Cannot initialize sieve machine: %s", mu_strerror (status));
    exit (EXIT_FAILURE);;
  }

  if (getenv ("MU_DEBUG"))
    {
      if ((status = mu_debug_create (&debug, mach)))
	{
	  mu_error ("mu_debug_create: %s", mu_strerror (status));
	  abort ();
	}
      if ((status = mu_debug_set_level (debug, MU_DEBUG_LEVEL)))
	{
	  mu_error ("mu_debug_set_level: %s", mu_strerror (status));
	  abort ();
	}
      sieve_set_debug_level (mach, debug, SIEVE_DEBUG_LEVEL);
    }

  status = sieve_compile(mach,argv[2]);
  if (status !=0) {
    mu_error ("Error compile sieve script: %s", mu_strerror (status));
    exit (EXIT_FAILURE);;
  }
  

  status = mailbox_create(&mbox, argv[1]);
  if (status != 0) {
    mu_error ("mailbox_create: %s", mu_strerror (status));
    exit (EXIT_FAILURE);
  }
  
  status = mailbox_open(mbox, MU_STREAM_READ);
  if (status != 0) {
    mu_error ("mailbox_open: %s", mu_strerror (status));
    exit (EXIT_FAILURE);
  }
  
  mailbox_messages_count (mbox, &total);
  
  for (msgno = 1; msgno <= total; msgno++) {

      message_t msg;
      header_t hdr;

      if ((status = mailbox_get_message (mbox, msgno, &msg)) != 0
	  || (status = message_get_header (msg, &hdr)) != 0) {
	mu_error ("Error message: %s", mu_strerror (status));
	exit (EXIT_FAILURE);
      }
      
      if (header_aget_value (hdr, MU_HEADER_FROM, &from))
	from = strdup ("(NO FROM)");
      
      if (header_aget_value (hdr, MU_HEADER_SUBJECT, &subject))
	subject = strdup ("(NO SUBJECT)");

      printf ("%s\t%s\n", from, subject);
      free (from);
      free (subject);
      status = sieve_message(mach,msg);
      if (status != 0)
	mu_error ("Error sieve_message: %s", mu_strerror (status));
  }
  
  status = mailbox_close (mbox);
  if (status != 0) {
    mu_error ("mailbox_close: %s", mu_strerror (status));
    exit (EXIT_FAILURE);
  }
  
  sieve_machine_destroy(&mach);
  mailbox_destroy (&mbox);
  return 0;
}

CC = gcc
CCOPTS = -Wall -pedantic -g  -ggdb -Wl,-R /usr/lib
LIBS = -lmailbox -lmu_mbox -lmu_maildir -lmu_mh -lsieve

default: all

all: testsieve 

testsieve: testsieve.c Makefile
        $(CC) $(CCOPTS) -o testsieve testsieve.c $(LIBS)
require ["fileinto","redirect"];

if header :contains "from" "Sergey"
 {
  fileinto "test.sergey"; 
 }
_______________________________________________
Bug-mailutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-mailutils

Reply via email to