mail-deliver.c revision 4c20874a726f2a88e133a7fb1fb07ea66a0b5a7c
/* Copyright (c) 2005-2010 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"
{
struct message_address *addr;
const char *str;
return NULL;
(const unsigned char *)str,
}
const struct var_expand_table *
{
static struct var_expand_table static_tab[] = {
};
struct var_expand_table *tab;
return tab;
}
{
const char *msg;
}
static const char *mailbox_name_to_mutf7(const char *mailbox_utf8)
{
return mailbox_utf8;
else
}
const char **error_r)
{
struct mail_namespace *ns;
struct mail_storage *storage;
enum mail_error error;
enum mailbox_flags flags =
*error_r = "Unknown namespace";
return -1;
}
/* delivering to a namespace prefix means we actually want to
deliver to the INBOX instead */
name = "INBOX";
}
/* deliveries to INBOX must always succeed,
regardless of ACLs */
}
if (mailbox_open(box) == 0)
return 0;
return -1;
/* try creating it. */
if (error != MAIL_ERROR_EXISTS)
return -1;
/* someone else just created it */
}
if (ctx->lda_mailbox_autosubscribe) {
/* (try to) subscribe to it */
}
/* and try opening again */
if (mailbox_sync(box, 0) < 0) {
return -1;
}
return 0;
}
struct mail_storage **storage_r)
{
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)
mailbox_free(&box);
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_free(&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;
}