+
+ /* see if a notification is needed */
+ if (bitset(QBADADDR, q->q_flags) &&
+ bitset(QPINGONFAILURE, q->q_flags))
+ {
+ failure_return = TRUE;
+ if (q->q_owner == NULL && !emptyaddr(&e->e_from))
+ (void) sendtolist(e->e_from.q_paddr, NULL,
+ &e->e_errorqueue, 0, e);
+ }
+ else if (bitset(QPINGONSUCCESS, q->q_flags) &&
+ ((bitset(QSENT, q->q_flags) &&
+ bitnset(M_LOCALMAILER, q->q_mailer->m_flags)) ||
+ bitset(QRELAYED|QEXPLODED, q->q_flags)))
+ {
+ success_return = TRUE;
+ }
+ }
+
+ if (e->e_class < 0)
+ e->e_flags |= EF_NO_BODY_RETN;
+
+ /*
+ ** See if the message timed out.
+ */
+
+ if (!queueit)
+ /* nothing to do */ ;
+ else if (curtime() > e->e_ctime + TimeOuts.to_q_return[e->e_timeoutclass])
+ {
+ (void) sprintf(buf, "Cannot send message for %s",
+ pintvl(TimeOuts.to_q_return[e->e_timeoutclass], FALSE));
+ if (e->e_message != NULL)
+ free(e->e_message);
+ e->e_message = newstr(buf);
+ message(buf);
+ e->e_flags |= EF_CLRQUEUE;
+ failure_return = TRUE;
+ fprintf(e->e_xfp, "Message could not be delivered for %s\n",
+ pintvl(TimeOuts.to_q_return[e->e_timeoutclass], FALSE));
+ fprintf(e->e_xfp, "Message will be deleted from queue\n");
+ for (q = e->e_sendqueue; q != NULL; q = q->q_next)
+ {
+ if (bitset(QQUEUEUP, q->q_flags))
+ q->q_flags |= QBADADDR;
+ }
+ }
+ else if (TimeOuts.to_q_warning[e->e_timeoutclass] > 0 &&
+ curtime() > e->e_ctime + TimeOuts.to_q_warning[e->e_timeoutclass])
+ {
+ bool delay_return = FALSE;
+
+ for (q = e->e_sendqueue; q != NULL; q = q->q_next)
+ {
+ if (bitset(QQUEUEUP, q->q_flags) &&
+ bitset(QPINGONDELAY, q->q_flags))
+ {
+ q->q_flags |= QREPORT;
+ delay_return = TRUE;
+ }
+ }
+ if (delay_return &&
+ !bitset(EF_WARNING|EF_RESPONSE, e->e_flags) &&
+ e->e_class >= 0 &&
+ strcmp(e->e_from.q_paddr, "<>") != 0 &&
+ strncasecmp(e->e_from.q_paddr, "owner-", 6) != 0 &&
+ (strlen(e->e_from.q_paddr) <= 8 ||
+ strcasecmp(&e->e_from.q_paddr[strlen(e->e_from.q_paddr) - 8], "-request") != 0))
+ {
+ (void) sprintf(buf,
+ "Warning: cannot send message for %s",
+ pintvl(TimeOuts.to_q_warning[e->e_timeoutclass], FALSE));
+ if (e->e_message != NULL)
+ free(e->e_message);
+ e->e_message = newstr(buf);
+ message(buf);
+ e->e_flags |= EF_WARNING;
+ failure_return = TRUE;
+ }
+ fprintf(e->e_xfp,
+ "Warning: message still undelivered after %s\n",
+ pintvl(TimeOuts.to_q_warning[e->e_timeoutclass], FALSE));
+ fprintf(e->e_xfp, "Will keep trying until message is %s old\n",
+ pintvl(TimeOuts.to_q_return[e->e_timeoutclass], FALSE));
+ }
+
+ if (tTd(50, 2))
+ printf("failure_return=%d success_return=%d queueit=%d\n",
+ failure_return, success_return, queueit);
+
+ /*
+ ** If we had some fatal error, but no addresses are marked as
+ ** bad, mark them _all_ as bad.
+ */
+
+ if (bitset(EF_FATALERRS, e->e_flags) && !failure_return)
+ {
+ failure_return = TRUE;
+ for (q = e->e_sendqueue; q != NULL; q = q->q_next)
+ {
+ if (!bitset(QDONTSEND, q->q_flags))
+ q->q_flags |= QBADADDR;
+ }