- if (save_errno > 0)
- message = US string_sprintf("%s: %s", message, strerror(save_errno));
- if (host->next != NULL) log_write(0, LOG_MAIN, "%s", message);
- deliver_msglog("%s %s\n", tod_stamp(tod_log), message);
- *message_defer = TRUE;
+ if (mua_wrapper) code = '5'; /* Force hard failure in wrapper mode */
+ set_errno(addrlist, save_errno, message, (code == '5')? FAIL : DEFER,
+ pass_message);
+
+ /* If there's an errno, the message contains just the identity of
+ the host. */
+
+ if (code != '5') /* Anything other than 5 is treated as temporary */
+ {
+ if (save_errno > 0)
+ message = US string_sprintf("%s: %s", message, strerror(save_errno));
+ if (host->next != NULL) log_write(0, LOG_MAIN, "%s", message);
+ deliver_msglog("%s %s\n", tod_stamp(tod_log), message);
+ *message_defer = TRUE;
+ }
+ }
+
+ /* Otherwise, we have an I/O error or a timeout other than after MAIL or
+ ".", or some other transportation error. We defer all addresses and yield
+ DEFER, except for the case of failed add_headers expansion, or a transport
+ filter failure, when the yield should be ERROR, to stop it trying other
+ hosts. */
+
+ else
+ {
+ yield = (save_errno == ERRNO_CHHEADER_FAIL ||
+ save_errno == ERRNO_FILTER_FAIL)? ERROR : DEFER;
+ set_errno(addrlist, save_errno, message, DEFER, pass_message);