mail-deliver.c revision f185133819c115c8cbc1c7e96804f237e23d255c
/* Copyright (c) 2005-2009 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "array.h"
#include "str.h"
#include "str-sanitize.h"
#include "var-expand.h"
#include "message-address.h"
#include "imap-utf7.h"
#include "lda-settings.h"
#include "mail-storage.h"
#include "mail-namespace.h"
#include "duplicate.h"
#include "mail-deliver.h"
const char *header)
{
struct message_address *addr;
const char *str;
return NULL;
(const unsigned char *)str,
}
static const struct var_expand_table *
{
static struct var_expand_table static_tab[] = {
};
struct var_expand_table *tab;
unsigned int i;
return tab;
}
{
const char *msg;
}
static struct mailbox *
const char **error_r)
{
struct mail_namespace *ns;
struct mail_storage *storage;
enum mail_error error;
enum mailbox_flags flags =
/* deliveries to INBOX must always succeed,
regardless of ACLs */
}
return NULL;
if (*name == '\0') {
/* delivering to a namespace prefix means we actually want to
deliver to the INBOX instead */
return NULL;
}
if (mailbox_open(box) == 0)
return box;
mailbox_close(&box);
return NULL;
}
/* try creating it. */
mailbox_close(&box);
return NULL;
}
/* (try to) subscribe to it */
}
/* and try opening again */
if (mailbox_open(box) < 0 ||
mailbox_close(&box);
return NULL;
}
return box;
}
static const char *mailbox_name_to_mutf7(const char *mailbox_utf8)
{
return mailbox_utf8;
else
}
struct mail_storage **storage_r)
{
struct mail_namespace *ns;
struct mailbox_transaction_context *t;
struct mail_save_context *save_ctx;
struct mail_keywords *kw;
enum mail_error error;
const char *mailbox_name, *errstr;
bool default_save;
int ret = 0;
if (default_save)
"save failed to %s: Unknown namespace",
return -1;
}
/* silently store to the INBOX instead */
return -1;
}
return -1;
}
if (ctx->save_dest_mail)
save_ctx = mailbox_save_alloc(t);
ret = -1;
if (ret < 0)
else
if (ret == 0) {
t = mailbox_transaction_begin(box, 0);
NULL);
}
}
} else {
}
mailbox_close(&box);
return ret;
}
{
return ctx->src_envelope_sender;
}
{
static int count = 0;
return t_strdup_printf("<dovecot-%s-%s-%d@%s>",
}
struct mail_storage **storage_r)
{
int ret;
if (deliver_mail == NULL)
ret = -1;
else {
/* if message was saved, don't bounce it even though
the script failed later. */
} else {
/* success. message may or may not have been saved. */
ret = 0;
}
}
/* plugins didn't handle this. save into the default mailbox. */
}
/* still didn't work. try once more to save it
to INBOX. */
}
return ret;
}