186 static void smtp_check_code(
SMTP_SESSION *session,
int code)
199 if (code < 400 || code > 599
201 || (code >= 500 && code < 510))
207 static int smtp_bulk_fail(
SMTP_STATE *state,
int throttle_queue)
214 int aggregate_status;
215 int soft_error = (
STR(why->
status)[0] ==
'4');
224 if ((soft_error || soft_bounce_error)
259 aggregate_status = 0;
271 aggregate_status |= status;
273 state->
status |= aggregate_status;
275 && throttle_queue && aggregate_status
283 if (throttle_queue && session)
304 static void vsmtp_fill_dsn(
SMTP_STATE *state,
const char *mta_name,
305 const char *status,
const char *reply,
306 const char *format, va_list ap)
319 if (mta_name && status && status[0] !=
'4' && status[0] !=
'5') {
339 va_start(ap, format);
340 vsmtp_fill_dsn(state, mta_name, resp->
dsn, resp->
str, format, ap);
343 if (state->
session && mta_name)
349 return (smtp_bulk_fail(state, throttle));
362 int soft_bounce_error;
374 va_start(ap, format);
375 vsmtp_fill_dsn(state, mta_name, resp->
dsn, resp->
str, format, ap);
380 if (state->
session && mta_name)
388 if ((soft_error || soft_bounce_error)
426 msg_panic(
"smtp_stream_except: no session");
433 msg_panic(
"smtp_stream_except: unknown exception %d", code);
435 dsb_simple(why,
"4.4.2",
"lost connection with %s while %s",
436 session->
namaddr, description);
443 dsb_simple(why,
"4.4.2",
"conversation with %s timed out while %s",
444 session->
namaddr, description);
452 dsb_simple(why,
"4.3.0",
"local data error while talking to %s",
struct SMTP_SESSION * session
NORETURN msg_panic(const char *fmt,...)
#define PLAINTEXT_FALLBACK_OK_AFTER_TLS_SESSION_FAILURE
void deliver_completed(VSTREAM *stream, long offset)
DELIVER_REQUEST * request
#define RETRY_AS_PLAINTEXT
#define DEL_REQ_TRACE_FLAGS(f)
VSTRING * vstring_strcpy(VSTRING *vp, const char *src)
int bounce_append(int flags, const char *id, MSG_STATS *stats, RECIPIENT *rcpt, const char *relay, DSN *dsn)
struct timeval conn_setup_done
#define SMTP_MISC_FLAG_COMPLETE_SESSION
int smtp_misc_fail(SMTP_STATE *state, int throttle, const char *mta_name, SMTP_RESP *resp, const char *format,...)
#define DSN_FROM_DSN_BUF(dsb)
int smtp_sess_fail(SMTP_STATE *state)
#define VSTRING_RESET(vp)
#define SMTP_RCPT_ISMARKED(rcpt)
#define SMTP_MISC_FLAG_FINAL_SERVER
#define SMTP_RCPT_DROP(state, rcpt)
#define DONT_CACHE_THROTTLED_SESSION
DSN_BUF * dsb_simple(DSN_BUF *dsb, const char *status, const char *format,...)
int smtp_stream_except(SMTP_STATE *state, int code, const char *description)
#define SMTP_RCPT_KEEP(state, rcpt)
#define SMTP_RCPT_LEFT(state)
VSTRING * vstring_vsprintf_append(VSTRING *vp, const char *format, va_list ap)
#define MAIL_ERROR_PROTOCOL
DSN_BUF * dsb_formal(DSN_BUF *dsb, const char *status, const char *action, const char *mtype, const char *mname, const char *dtype, const char *dtext)
int defer_append(int flags, const char *id, MSG_STATS *stats, RECIPIENT *rcpt, const char *relay, DSN *dsn)
void smtp_rcpt_fail(SMTP_STATE *state, RECIPIENT *rcpt, const char *mta_name, SMTP_RESP *resp, const char *format,...)
struct timeval deliver_done
void msg_info(const char *fmt,...)