summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2015-11-10 23:12:26 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2015-11-12 18:01:33 +0000
commit1a47b633600e808a11d75551306a2bf8ebf87335 (patch)
tree9d295a9d5341c7aee3b0e948a7fcf261d73345a9 /src
parent4b4a0e99e3329ce10b2bf1bbaae91836a4a20e3d (diff)
Logging: support +outgoing_port on defer lines and per-host error lines
Diffstat (limited to 'src')
-rw-r--r--src/src/deliver.c8
-rw-r--r--src/src/transports/smtp.c23
2 files changed, 19 insertions, 12 deletions
diff --git a/src/src/deliver.c b/src/src/deliver.c
index f3ae2208a..e1f4e0e29 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -1288,9 +1288,17 @@ else if (result == DEFER || result == PANIC)
US strerror(addr->basic_errno));
if (addr->host_used)
+ {
s = string_append(s, &size, &ptr, 5,
US" H=", addr->host_used->name,
US" [", addr->host_used->address, US"]");
+ if (LOGGING(outgoing_port))
+ {
+ int port = addr->host_used->port;
+ s = string_append(s, &size, &ptr, 2,
+ US":", port == PORT_NONE ? US"25" : string_sprintf("%d", port));
+ }
+ }
if (addr->message)
s = string_append(s, &size, &ptr, 2, US": ", addr->message);
diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c
index eae54764b..59afe42aa 100644
--- a/src/src/transports/smtp.c
+++ b/src/src/transports/smtp.c
@@ -655,6 +655,9 @@ write_logs(address_item *addr, host_item *host)
{
uschar * message = string_sprintf("H=%s [%s]", host->name, host->address);
+if (LOGGING(outgoing_port))
+ message = string_sprintf("%s:%d", message,
+ host->port == PORT_NONE ? 25 : host->port);
if (addr->message)
{
message = string_sprintf("%s: %s", message, addr->message);
@@ -665,9 +668,6 @@ if (addr->message)
}
else
{
- if (LOGGING(outgoing_port))
- message = string_sprintf("%s:%d", message,
- host->port == PORT_NONE ? 25 : host->port);
log_write(0, LOG_MAIN, "%s %s", message, strerror(addr->basic_errno));
deliver_msglog("%s %s %s\n", tod_stamp(tod_log), message,
strerror(addr->basic_errno));
@@ -3618,15 +3618,14 @@ for (cutoff_retry = 0; expired &&
host_item *h;
DEBUG(D_transport)
debug_printf("hosts_max_try limit reached with this host\n");
- for (h = host; h != NULL; h = h->next)
- if (h->mx != host->mx) break;
- if (h != NULL)
- {
- nexthost = h;
- unexpired_hosts_tried--;
- DEBUG(D_transport) debug_printf("however, a higher MX host exists "
- "and will be tried\n");
- }
+ for (h = host; h; h = h->next) if (h->mx != host->mx)
+ {
+ nexthost = h;
+ unexpired_hosts_tried--;
+ DEBUG(D_transport) debug_printf("however, a higher MX host exists "
+ "and will be tried\n");
+ break;
+ }
}
/* Attempt the delivery. */