dbffb9e8b87b771851700a1acc353aa62b5ab7d7Timo Sirainen /* List of INBOX GUIDs where this mail has already been saved to */
eed03830015b7138b9d4522e72bef650aa24b45fTimo Sirainen /* Session ID, used as log line prefix if non-NULL. */
58c61ac5650583d21c891e61e051c614290d31fbTimo Sirainen /* Mail to save */
58c61ac5650583d21c891e61e051c614290d31fbTimo Sirainen /* Envelope sender, if known. */
de0971aff3009fe6906c3631e8322908658a5e93Stephan Bosch /* MAIL parameters */
a77f136d3603a36f6cdd2e3685a5b18dd3712d79Stephan Bosch /* Envelope recipient (final recipient) */
de0971aff3009fe6906c3631e8322908658a5e93Stephan Bosch /* RCPT parameters (can contain original recipient) */
58c61ac5650583d21c891e61e051c614290d31fbTimo Sirainen /* Destination user */
58c61ac5650583d21c891e61e051c614290d31fbTimo Sirainen /* Mailbox where mail should be saved, unless e.g. Sieve does
58c61ac5650583d21c891e61e051c614290d31fbTimo Sirainen something to it. */
2ef5254ab6b446b93ce7733bc96eeefa6f731ee4Timo Sirainen /* Filled with destination mail, if save_dest_mail=TRUE.
2ef5254ab6b446b93ce7733bc96eeefa6f731ee4Timo Sirainen The caller must free the mail, its transaction and close
2ef5254ab6b446b93ce7733bc96eeefa6f731ee4Timo Sirainen the mailbox. */
12e28ffc2655b6d0efce628eb7d93fa74fbd345bTimo Sirainen /* mail_deliver_log() caches the var expand table values here */
b9dce659b9135c87c7708b2bb0f14e8742db7e15Timo Sirainen /* Error message for a temporary failure. This is necessary only when
b9dce659b9135c87c7708b2bb0f14e8742db7e15Timo Sirainen there is no storage where to get the error message from. */
6682872f15fc74c1aa8898d4dc5745ff6a5dc51eTimo Sirainen /* Delivery failed because user is out of quota / disk space */
6cc815e209fa75989ad2a309119d4f286a6ea00fTimo Sirainen /* Send DSN instead of MDN */
58c61ac5650583d21c891e61e051c614290d31fbTimo Sirainentypedef int deliver_mail_func_t(struct mail_deliver_context *ctx,
6b6011c2242e470b41316f92512b282b5e306dacTimo Sirainenmail_deliver_ctx_get_log_var_expand_table(struct mail_deliver_context *ctx,
6b6011c2242e470b41316f92512b282b5e306dacTimo Sirainen const char *message);
58c61ac5650583d21c891e61e051c614290d31fbTimo Sirainenvoid mail_deliver_log(struct mail_deliver_context *ctx, const char *fmt, ...)
3d7828efd92ecc0d08049f727d9be0154d1d681bStephan Boschmail_deliver_get_address(struct mail *mail, const char *header);
3d7828efd92ecc0d08049f727d9be0154d1d681bStephan Boschmail_deliver_get_return_address(struct mail_deliver_context *ctx);
58c61ac5650583d21c891e61e051c614290d31fbTimo Sirainenconst char *mail_deliver_get_new_message_id(struct mail_deliver_context *ctx);
44f3f472a49078312432b785fddcfe7b95928391Timo Sirainenstruct mail_deliver_session *mail_deliver_session_init(void);
44f3f472a49078312432b785fddcfe7b95928391Timo Sirainenvoid mail_deliver_session_deinit(struct mail_deliver_session **session);
f9db221d0793f05c4631885e71f98145428a7e1bTimo Sirainen/* Try to open mailbox for saving. Returns 0 if ok, -1 if error. The box may
f9db221d0793f05c4631885e71f98145428a7e1bTimo Sirainen be returned even with -1, and the caller must free it then. */
f9db221d0793f05c4631885e71f98145428a7e1bTimo Sirainenint mail_deliver_save_open(struct mail_deliver_save_open_context *ctx,
258adfa09081ea8600a39759d486e678b5aa5f60Timo Sirainen enum mail_error *error_r, const char **error_str_r);
58c61ac5650583d21c891e61e051c614290d31fbTimo Sirainenint mail_deliver_save(struct mail_deliver_context *ctx, const char *mailbox,
58c61ac5650583d21c891e61e051c614290d31fbTimo Sirainen enum mail_flags flags, const char *const *keywords,
a10ed8c47534b4c6b6bf2711ccfe577e720a47b4Timo Sirainen struct mail_storage **storage_r) ATTR_NULL(4);
21fdf5394fbc307673b6c4b33f2497751a9ca1feTimo Sirainenvoid mail_deliver_deduplicate_guid_if_needed(struct mail_deliver_session *session,
58c61ac5650583d21c891e61e051c614290d31fbTimo Sirainenint mail_deliver(struct mail_deliver_context *ctx,
92e6bb6497f8c9d57bff334a5c9f31bc2f040394Timo Sirainen/* Sets the deliver_mail hook and returns the previous hook,
92e6bb6497f8c9d57bff334a5c9f31bc2f040394Timo Sirainen which the new_hook should call if it's non-NULL. */
92e6bb6497f8c9d57bff334a5c9f31bc2f040394Timo Sirainendeliver_mail_func_t *mail_deliver_hook_set(deliver_mail_func_t *new_hook);
eed56fe22f1fc61f2003d5e66373d03dacbc9aaaTimo Sirainen/* Must be called before any storage is created. */