SMTPClient: Relaying: add safeguard we don't try to attempt to deliver directly.
[citadel.git] / citadel / modules / smtp / serv_smtpeventclient.c
index 56deb4f5034f1785952ea0e6cf6ca4b6830bfdb9..9e97dda97aed2e8660abb7b31cf1d46b3d0e83f1 100644 (file)
@@ -237,6 +237,13 @@ eNextState FailOneAttempt(AsyncIO *IO)
 
        if (Msg->pCurrRelay != NULL)
                Msg->pCurrRelay = Msg->pCurrRelay->Next;
+       if ((Msg->pCurrRelay != NULL) &&
+           !Msg->pCurrRelay->IsRelay &&
+           Msg->MyQItem->HaveRelay)
+       {
+               EVS_syslog(LOG_DEBUG, "%s Aborting; last relay failed.\n", __FUNCTION__);
+               return eAbort;
+       }
 
        if (Msg->pCurrRelay == NULL) {
                EVS_syslog(LOG_DEBUG, "%s Aborting\n", __FUNCTION__);