X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fsmtp%2Fserv_smtpeventclient.c;h=2869b8d44cc7e06c2531e71026f88bed4674549b;hb=1f492ac650c71a515d36571d5c0a5effd05779dd;hp=ffdc63d0ea3831442305b3ddaf5d5a822862ee57;hpb=7bce9e15181135c65c462a1d6ab1d75d80dce84b;p=citadel.git diff --git a/citadel/modules/smtp/serv_smtpeventclient.c b/citadel/modules/smtp/serv_smtpeventclient.c index ffdc63d0e..2869b8d44 100644 --- a/citadel/modules/smtp/serv_smtpeventclient.c +++ b/citadel/modules/smtp/serv_smtpeventclient.c @@ -90,6 +90,7 @@ #include "smtpqueue.h" #include "smtp_clienthandlers.h" +int SMTPClientDebugEnabled = 0; const unsigned short DefaultMXPort = 25; void DeleteSmtpOutMsg(void *v) { @@ -136,7 +137,26 @@ 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 Time[%fs] Recipient <%s> @ <%s> (%s) Statusmessage: %s\n", + Status, + Msg->IO.Now - Msg->IO.StartIO, + Msg->user, + Msg->node, + Msg->name, + ChrPtr(Msg->MyQEntry->StatusMessage)); + + Msg->IDestructQueItem = DecreaseQReference(Msg->MyQItem); Msg->nRemain = CountActiveQueueEntries(Msg->MyQItem); @@ -354,6 +374,9 @@ eNextState get_one_mx_host_ip_done(AsyncIO *IO) struct hostent *hostent; QueryCbDone(IO); + EVS_syslog(LOG_DEBUG, "SMTP: %s Time[%fs]\n", + __FUNCTION__, + IO->Now - IO->DNS.Start); hostent = Msg->HostLookup.VParsedDNSReply; if ((Msg->HostLookup.DNSStatus == ARES_SUCCESS) && @@ -413,8 +436,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, @@ -451,7 +472,9 @@ eNextState smtp_resolve_mx_record_done(AsyncIO *IO) QueryCbDone(IO); - EVS_syslog(LOG_DEBUG, "SMTP: %s\n", __FUNCTION__); + EVS_syslog(LOG_DEBUG, "SMTP: %s Time[%fs]\n", + __FUNCTION__, + IO->Now - IO->DNS.Start); pp = &Msg->Relay; while ((pp != NULL) && (*pp != NULL) && ((*pp)->Next != NULL)) @@ -807,7 +830,14 @@ eReadState SMTP_C_ReadServerStatus(AsyncIO *IO) return Finished; } +void LogDebugEnableSMTPClient(void) +{ + SMTPClientDebugEnabled = 1; +} + CTDL_MODULE_INIT(smtp_eventclient) { + if (!threading) + CtdlRegisterDebugFlagHook(HKEY("smtpeventclient"), LogDebugEnableSMTPClient); return "smtpeventclient"; }