summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2019-12-14 23:01:03 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2019-12-15 13:28:47 +0000
commit78598e6a6a8cda8d1b50685188682749929df614 (patch)
treeb3c45b92b9be969ce712d39cdb2e543d7320198c /src
parentde41aff0511cad420dd1936b23dce61e04ce6ab4 (diff)
Events: add msg:defer Bug 2477
Diffstat (limited to 'src')
-rw-r--r--src/src/transports/smtp.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c
index 99b793bb5..92723a2c1 100644
--- a/src/src/transports/smtp.c
+++ b/src/src/transports/smtp.c
@@ -766,12 +766,13 @@ deliver_msglog("%s H=%s [%s] %s\n", tod_stamp(tod_log),
Arguments:
addr the address item containing error information
host the current host
+ evstr the event
Returns: nothing
*/
static void
-deferred_event_raise(address_item *addr, host_item *host)
+deferred_event_raise(address_item * addr, host_item * host, uschar * evstr)
{
uschar * action = addr->transport->event_action;
const uschar * save_domain;
@@ -793,7 +794,7 @@ transport_name = addr->transport->name;
deliver_domain = addr->domain;
deliver_localpart = addr->local_part;
-(void) event_raise(action, US"msg:host:defer",
+(void) event_raise(action, evstr,
addr->message
? addr->basic_errno > 0
? string_sprintf("%s: %s", addr->message, strerror(addr->basic_errno))
@@ -5150,7 +5151,7 @@ retry_non_continued:
#ifndef DISABLE_EVENT
if (rc == DEFER)
- deferred_event_raise(first_addr, host);
+ deferred_event_raise(first_addr, host, US"msg:host:defer");
#endif
/* If STARTTLS was accepted, but there was a failure in setting up the
@@ -5178,11 +5179,18 @@ retry_non_continued:
if (rc == DEFER && first_addr->basic_errno != ERRNO_AUTHFAIL)
write_logs(host, first_addr->message, first_addr->basic_errno);
# ifndef DISABLE_EVENT
- if (rc == DEFER)
- deferred_event_raise(first_addr, host);
+ if (rc == DEFER)
+ deferred_event_raise(first_addr, host, US"msg:host:defer");
# endif
}
#endif /*DISABLE_TLS*/
+
+#ifndef DISABLE_EVENT
+ /* If the last host gave a defer raise a per-message event */
+
+ if (!nexthost && (message_defer || rc == DEFER))
+ deferred_event_raise(first_addr, host, US"msg:defer");
+#endif
}
/* Delivery attempt finished */