#ifndef MAIL_DELIVER_H
#define MAIL_DELIVER_H
#include "guid.h"
#include "mail-types.h"
#include "mail-error.h"
#include "smtp-params.h"
struct smtp_address;
struct mail_storage;
struct mail_save_context;
struct mailbox;
struct mail_deliver_session {
/* List of INBOX GUIDs where this mail has already been saved to */
};
struct mail_deliver_context {
unsigned int session_time_msecs;
/* Session ID, used as log line prefix if non-NULL. */
const char *session_id;
/* Mail to save */
/* Envelope sender, if known. */
/* MAIL parameters */
/* Envelope recipient (final recipient) */
/* RCPT parameters (can contain original recipient) */
/* Destination user */
/* Mailbox where mail should be saved, unless e.g. Sieve does
something to it. */
const char *rcpt_default_mailbox;
/* Filled with destination mail, if save_dest_mail=TRUE.
The caller must free the mail, its transaction and close
the mailbox. */
/* mail_deliver_log() caches the var expand table values here */
/* Error message for a temporary failure. This is necessary only when
there is no storage where to get the error message from. */
const char *tempfail_error;
bool tried_default_save;
bool saved_mail;
bool save_dest_mail;
/* Delivery failed because user is out of quota / disk space */
bool mailbox_full;
/* Send DSN instead of MDN */
bool dsn;
};
struct mail_deliver_save_open_context {
bool lda_mailbox_autocreate;
};
struct mail_storage **storage_r);
extern deliver_mail_func_t *deliver_mail;
const struct var_expand_table *
const char *message);
const struct smtp_address *
const struct smtp_address *
struct mail_deliver_session *mail_deliver_session_init(void);
/* Try to open mailbox for saving. Returns 0 if ok, -1 if error. The box may
be returned even with -1, and the caller must free it then. */
struct mail_save_context *save_ctx);
struct mail_storage **storage_r);
/* Sets the deliver_mail hook and returns the previous hook,
which the new_hook should call if it's non-NULL. */
/* Must be called before any storage is created. */
void mail_deliver_hooks_init(void);
#endif