X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fsmtp%2Fserv_smtpeventclient.c;h=1698ab74773c1886d7152a3e6b088f1594b12abc;hb=91d5dd26d1d156e2bea3193b283144ff2f854d00;hp=c8da5590e63b62841f30a3cfccf81331957679bc;hpb=91a9b8806b53105a54a4bc83bb40d68b5d6f0b6d;p=citadel.git diff --git a/citadel/modules/smtp/serv_smtpeventclient.c b/citadel/modules/smtp/serv_smtpeventclient.c index c8da5590e..1698ab747 100644 --- a/citadel/modules/smtp/serv_smtpeventclient.c +++ b/citadel/modules/smtp/serv_smtpeventclient.c @@ -136,7 +136,25 @@ eNextState FinalizeMessageSend_DB4(AsyncIO *IO); ******************************************************************************/ inline void FinalizeMessageSend_1(AsyncIO *IO) { + const char *Status; SmtpOutMsg *Msg = IO->Data; + + if (Msg->MyQEntry->Status == 2) + Status = "Delivery Successfull."; + else if (Msg->MyQEntry->Status == 5) + Status = "Delivery failed permanently; giving up."; + else + Status = "Delivery failed temporarily; will retry later."; + + EVS_syslog(LOG_INFO, + "SMTP: %s Recipient <%s> @ <%s> (%s) Statusmessage: %s\n", + Status, + Msg->user, + Msg->node, + Msg->name, + ChrPtr(Msg->MyQEntry->StatusMessage)); + + Msg->IDestructQueItem = DecreaseQReference(Msg->MyQItem); Msg->nRemain = CountActiveQueueEntries(Msg->MyQItem); @@ -231,11 +249,11 @@ eNextState FinalizeMessageSend_DB3(AsyncIO *IO) eNextState FinalizeMessageSend_DB4(AsyncIO *IO) { - int n; + int Done; SmtpOutMsg *Msg = IO->Data; - n = GetShutdownDeliveries(Msg->MyQItem); - if (n > 0) + Done = GetShutdownDeliveries(Msg->MyQItem); + if (!Done) return NextDBOperation(IO, FinalizeMessageSend_DB4); else return eAbort; @@ -388,10 +406,19 @@ eNextState get_one_mx_host_ip_done(AsyncIO *IO) addr->sin_port = htons(DefaultMXPort); } Msg->mx_host = Msg->pCurrRelay->Host; + if (Msg->HostLookup.VParsedDNSReply != NULL) { + Msg->HostLookup.DNSReplyFree(Msg->HostLookup.VParsedDNSReply); + Msg->HostLookup.VParsedDNSReply = NULL; + } return mx_connect_ip(IO); } - else + else { + if (Msg->HostLookup.VParsedDNSReply != NULL) { + Msg->HostLookup.DNSReplyFree(Msg->HostLookup.VParsedDNSReply); + Msg->HostLookup.VParsedDNSReply = NULL; + } return FailOneAttempt(IO); + } } eNextState get_one_mx_host_ip(AsyncIO *IO) @@ -404,8 +431,6 @@ eNextState get_one_mx_host_ip(AsyncIO *IO) * - one of the mx'es */ - InitC_ares_dns(IO); - EVS_syslog(LOG_DEBUG, "SMTP: %s\n", __FUNCTION__); EVS_syslog(LOG_DEBUG,