ctx.session = mail_deliver_session_init();
ctx.pool = ctx.session->pool;
ctx.dest_mailbox_name = "INBOX";
+ ctx.timeout_secs = LDA_SUBMISSION_TIMEOUT_SECS;
path = NULL;
user = getenv("USER");
#include "mail-types.h"
#include "mail-error.h"
+/* How many seconds to wait for replies from SMTP before failing. Used for
+ sending rejects, forward, etc. */
+#define LDA_SUBMISSION_TIMEOUT_SECS 30
+
struct mail_storage;
struct mail_save_context;
struct mailbox;
pool_t pool;
const struct lda_settings *set;
struct mail_deliver_session *session;
+ unsigned int timeout_secs;
struct duplicate_context *dup_ctx;
str_truncate(str, 0);
str_printfa(str, "\r\n\r\n--%s--\r\n", boundary);
o_stream_nsend(output, str_data(str), str_len(str));
- if ((ret = smtp_client_deinit(smtp_client, &error)) < 0) {
+ if ((ret = smtp_client_deinit_timeout(smtp_client, ctx->timeout_secs, &error)) < 0) {
i_error("msgid=%s: Temporarily failed to send rejection: %s",
orig_msgid == NULL ? "" : str_sanitize(orig_msgid, 80),
str_sanitize(error, 512));
dctx.session = session;
dctx.pool = session->pool;
dctx.set = lda_set;
+ dctx.timeout_secs = LDA_SUBMISSION_TIMEOUT_SECS;
dctx.session_id = client->state.session_id;
dctx.src_mail = src_mail;
dctx.src_envelope_sender = client->state.mail_from;