[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-mailutils] [Error] fileinto: cannot save to mailbox: Function n
From: |
Sergey Poznyakoff |
Subject: |
Re: [bug-mailutils] [Error] fileinto: cannot save to mailbox: Function not implemented |
Date: |
Wed, 22 Jun 2005 15:55:10 +0300 |
Kostas Zorbadelos <address@hidden> wrote:
> I call this program as
> ./testsieve file://path/to/Maildir filters.sieve
>
> and in the output I get
[...]
> fileinto: cannot save to mailbox: Function not implemented
> ...
>
> I also get a zero length file test.mbox created but no mail is
> delivered there.
Hmm, that's strange. I have tried your program and recieved the expected
behavior without any errors. Possibly there are some conditions I was
not able to reproduce.
Included is a modified version of your program that implements some
rudimentary debugging features. Please, try running it, having defined
previously environment variable MU_DEBUG, e.g.:
MU_DEBUG=1 ./testsieve file://path/to/Maildir filters.sieve
What does it output?
Regards,
Sergey
/*------------------------------------------------------------------
* 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)
#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 (); */
/* 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;
}
- [bug-mailutils] [Error] fileinto: cannot save to mailbox: Function not implemented, Kostas Zorbadelos, 2005/06/22
- Re: [bug-mailutils] [Error] fileinto: cannot save to mailbox: Function not implemented, Sergey Poznyakoff, 2005/06/22
- Re: [bug-mailutils] [Error] fileinto: cannot save to mailbox: Function not implemented, Kostas Zorbadelos, 2005/06/22
- Re: [bug-mailutils] [Error] fileinto: cannot save to mailbox: Function not implemented,
Sergey Poznyakoff <=
- Re: [bug-mailutils] [Error] fileinto: cannot save to mailbox: Function not implemented, Kostas Zorbadelos, 2005/06/22
- Re: [bug-mailutils] [Error] fileinto: cannot save to mailbox: Function not implemented, Sergey Poznyakoff, 2005/06/22
- Message not available
- Message not available
- Re: [bug-mailutils] [Error] fileinto: cannot save to mailbox: Function not implemented, Kostas Zorbadelos, 2005/06/23
- Re: [bug-mailutils] [Error] fileinto: cannot save to mailbox: Function not implemented, Sergey Poznyakoff, 2005/06/23
- Re: [bug-mailutils] [Error] fileinto: cannot save to mailbox: Function not implemented, Kostas Zorbadelos, 2005/06/23
- Re: [bug-mailutils] [Error] fileinto: cannot save to mailbox: Function not implemented, Kostas Zorbadelos, 2005/06/23
- Re: [bug-mailutils] [Error] fileinto: cannot save to mailbox: Function not implemented, Sergey Poznyakoff, 2005/06/24
- Re: [bug-mailutils] [Error] fileinto: cannot save to mailbox: Function not implemented, Kostas Zorbadelos, 2005/06/28