2 * This module is an SMTP and ESMTP implementation for the Citadel system.
3 * It is compliant with all of the following:
5 * RFC 821 - Simple Mail Transfer Protocol
6 * RFC 876 - Survey of SMTP Implementations
7 * RFC 1047 - Duplicate messages and SMTP
8 * RFC 1652 - 8 bit MIME
9 * RFC 1869 - Extended Simple Mail Transfer Protocol
10 * RFC 1870 - SMTP Service Extension for Message Size Declaration
11 * RFC 2033 - Local Mail Transfer Protocol
12 * RFC 2197 - SMTP Service Extension for Command Pipelining
13 * RFC 2476 - Message Submission
14 * RFC 2487 - SMTP Service Extension for Secure SMTP over TLS
15 * RFC 2554 - SMTP Service Extension for Authentication
16 * RFC 2821 - Simple Mail Transfer Protocol
17 * RFC 2822 - Internet Message Format
18 * RFC 2920 - SMTP Service Extension for Command Pipelining
20 * The VRFY and EXPN commands have been removed from this implementation
21 * because nobody uses these commands anymore, except for spammers.
23 * Copyright (c) 1998-2012 by the citadel.org team
25 * This program is open source software; you can redistribute it and/or modify
26 * it under the terms of the GNU General Public License version 3.
30 * This program is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU General Public License for more details.
49 #include <sys/types.h>
52 #if TIME_WITH_SYS_TIME
53 # include <sys/time.h>
57 # include <sys/time.h>
66 #include <sys/socket.h>
67 #include <netinet/in.h>
68 #include <arpa/inet.h>
69 #include <libcitadel.h>
72 #include "citserver.h"
79 #include "internet_addressing.h"
82 #include "clientsocket.h"
83 #include "locate_host.h"
84 #include "citadel_dirs.h"
86 #include "ctdl_module.h"
88 #include "smtp_util.h"
89 #include "event_client.h"
90 #include "smtpqueue.h"
91 #include "smtp_clienthandlers.h"
93 int SMTPClientDebugEnabled = 0;
94 const unsigned short DefaultMXPort = 25;
95 void DeleteSmtpOutMsg(void *v)
98 AsyncIO *IO = &Msg->IO;
99 EV_syslog(LOG_DEBUG, "SMTP: %s Aborting\n", __FUNCTION__);
101 /* these are kept in our own space and free'd below */
102 Msg->IO.ConnectMe = NULL;
104 ares_free_data(Msg->AllMX);
105 if (Msg->HostLookup.VParsedDNSReply != NULL)
106 Msg->HostLookup.DNSReplyFree(Msg->HostLookup.VParsedDNSReply);
107 FreeURL(&Msg->Relay);
108 FreeStrBuf(&Msg->msgtext);
109 FreeAsyncIOContents(&Msg->IO);
110 memset (Msg, 0, sizeof(SmtpOutMsg)); /* just to be shure... */
114 eNextState SMTP_C_Shutdown(AsyncIO *IO);
115 eNextState SMTP_C_Timeout(AsyncIO *IO);
116 eNextState SMTP_C_ConnFail(AsyncIO *IO);
117 eNextState SMTP_C_DispatchReadDone(AsyncIO *IO);
118 eNextState SMTP_C_DispatchWriteDone(AsyncIO *IO);
119 eNextState SMTP_C_DNSFail(AsyncIO *IO);
120 eNextState SMTP_C_Terminate(AsyncIO *IO);
121 eNextState SMTP_C_TerminateDB(AsyncIO *IO);
122 eReadState SMTP_C_ReadServerStatus(AsyncIO *IO);
124 eNextState mx_connect_ip(AsyncIO *IO);
125 eNextState get_one_mx_host_ip(AsyncIO *IO);
126 eNextState FinalizeMessageSendDB(AsyncIO *IO);
127 eNextState FinalizeMessageSend_DB1(AsyncIO *IO);
128 eNextState FinalizeMessageSend_DB2(AsyncIO *IO);
129 eNextState FinalizeMessageSend_DB3(AsyncIO *IO);
130 eNextState FinalizeMessageSend_DB4(AsyncIO *IO);
132 /******************************************************************************
133 * So, we're finished with sending (regardless of success or failure) *
134 * This Message might be referenced by several Queue-Items, if we're the last,*
135 * we need to free the memory and send bounce messages (on terminal failure) *
136 * else we just free our SMTP-Message struct. *
137 ******************************************************************************/
138 inline void FinalizeMessageSend_1(AsyncIO *IO)
141 SmtpOutMsg *Msg = IO->Data;
143 if (Msg->MyQEntry->Status == 2)
144 Status = "Delivery Successfull.";
145 else if (Msg->MyQEntry->Status == 5)
146 Status = "Delivery failed permanently; giving up.";
148 Status = "Delivery failed temporarily; will retry later.";
151 "SMTP: %s Time[%fs] Recipient <%s> @ <%s> (%s) Statusmessage: %s\n",
153 Msg->IO.Now - Msg->IO.StartIO,
157 ChrPtr(Msg->MyQEntry->StatusMessage));
160 Msg->IDestructQueItem = DecreaseQReference(Msg->MyQItem);
162 Msg->nRemain = CountActiveQueueEntries(Msg->MyQItem);
164 if (Msg->MyQEntry->Active &&
165 CheckQEntryIsBounce(Msg->MyQEntry))
167 /* are we casue for a bounce mail? */
168 Msg->MyQItem->SendBounceMail |= (1<<Msg->MyQEntry->Status);
171 if ((Msg->nRemain > 0) || Msg->IDestructQueItem)
172 Msg->QMsgData = SerializeQueueItem(Msg->MyQItem);
174 Msg->QMsgData = NULL;
176 eNextState FinalizeMessageSend(SmtpOutMsg *Msg)
178 return QueueDBOperation(&Msg->IO, FinalizeMessageSend_DB1);
181 inline void FinalizeMessageSend_DB_1(AsyncIO *IO)
183 SmtpOutMsg *Msg = IO->Data;
186 * Uncompleted delivery instructions remain, so delete the old
187 * instructions and replace with the updated ones.
189 EVS_syslog(LOG_DEBUG, "SMTPQD: %ld", Msg->MyQItem->QueMsgID);
190 CtdlDeleteMessages(SMTP_SPOOLOUT_ROOM, &Msg->MyQItem->QueMsgID, 1, "");
192 eNextState FinalizeMessageSend_DB1(AsyncIO *IO)
194 FinalizeMessageSend_1(IO);
195 FinalizeMessageSend_DB_1(IO);
196 return NextDBOperation(IO, FinalizeMessageSend_DB2);
200 inline void FinalizeMessageSend_DB_2(AsyncIO *IO)
202 SmtpOutMsg *Msg = IO->Data;
204 if (Msg->IDestructQueItem)
205 smtpq_do_bounce(Msg->MyQItem, Msg->msgtext);
207 eNextState FinalizeMessageSend_DB2(AsyncIO *IO)
209 FinalizeMessageSend_DB_2(IO);
211 return NextDBOperation(IO, FinalizeMessageSend_DB3);
215 inline void FinalizeMessageSend_DB_3(AsyncIO *IO)
217 SmtpOutMsg *Msg = IO->Data;
219 if (Msg->nRemain > 0)
221 struct CtdlMessage *msg;
222 msg = malloc(sizeof(struct CtdlMessage));
223 memset(msg, 0, sizeof(struct CtdlMessage));
224 msg->cm_magic = CTDLMESSAGE_MAGIC;
225 msg->cm_anon_type = MES_NORMAL;
226 msg->cm_format_type = FMT_RFC822;
227 msg->cm_fields['M'] = SmashStrBuf(&Msg->QMsgData);
228 msg->cm_fields['U'] = strdup("QMSG");
229 Msg->MyQItem->QueMsgID =
230 CtdlSubmitMsg(msg, NULL, SMTP_SPOOLOUT_ROOM, QP_EADDR);
231 EVS_syslog(LOG_DEBUG, "SMTPQ: %ld", Msg->MyQItem->QueMsgID);
232 CtdlFreeMessage(msg);
235 CtdlDeleteMessages(SMTP_SPOOLOUT_ROOM,
236 &Msg->MyQItem->MessageID,
239 FreeStrBuf(&Msg->QMsgData);
241 DecreaseShutdownDeliveries(Msg->MyQItem);
243 eNextState FinalizeMessageSend_DB3(AsyncIO *IO)
245 SmtpOutMsg *Msg = IO->Data;
246 FinalizeMessageSend_DB_3(IO);
247 if (!Msg->IDestructQueItem)
249 return NextDBOperation(IO, FinalizeMessageSend_DB4);
252 eNextState FinalizeMessageSend_DB4(AsyncIO *IO)
255 SmtpOutMsg *Msg = IO->Data;
257 Done = GetShutdownDeliveries(Msg->MyQItem);
259 return NextDBOperation(IO, FinalizeMessageSend_DB4);
264 eNextState FinalizeMessageSend_DB(AsyncIO *IO)
266 SmtpOutMsg *Msg = IO->Data;
268 RemoveContext(Msg->IO.CitContext);
269 if (Msg->IDestructQueItem)
270 RemoveQItem(Msg->MyQItem);
271 DeleteSmtpOutMsg(Msg);
275 eNextState FailOneAttempt(AsyncIO *IO)
277 SmtpOutMsg *Msg = IO->Data;
279 if (Msg->MyQEntry->Status == 2)
283 * possible ways here:
284 * - connection timeout
285 * - dns lookup failed
287 StopClientWatchers(IO);
289 if (Msg->pCurrRelay != NULL)
290 Msg->pCurrRelay = Msg->pCurrRelay->Next;
292 if (Msg->pCurrRelay == NULL) {
293 EVS_syslog(LOG_DEBUG, "SMTP: %s Aborting\n", __FUNCTION__);
296 if (Msg->pCurrRelay->IsIP) {
297 EVS_syslog(LOG_DEBUG, "SMTP: %s connecting IP\n", __FUNCTION__);
298 return mx_connect_ip(IO);
301 EVS_syslog(LOG_DEBUG,
302 "SMTP: %s resolving next MX Record\n",
304 return get_one_mx_host_ip(IO);
309 void SetConnectStatus(AsyncIO *IO)
311 SmtpOutMsg *Msg = IO->Data;
317 if (IO->ConnectMe->IPv6) {
318 src = &IO->ConnectMe->Addr.sin6_addr;
321 struct sockaddr_in *addr;
323 addr = (struct sockaddr_in *)&IO->ConnectMe->Addr;
324 src = &addr->sin_addr.s_addr;
327 inet_ntop((IO->ConnectMe->IPv6)?AF_INET6:AF_INET,
332 if (Msg->mx_host == NULL)
333 Msg->mx_host = "<no MX-Record>";
335 EVS_syslog(LOG_DEBUG,
336 "SMTP client[%ld]: connecting to %s [%s]:%d ...\n",
340 Msg->IO.ConnectMe->Port);
342 Msg->MyQEntry->Status = 5;
343 StrBufPrintf(Msg->MyQEntry->StatusMessage,
344 "Timeout while connecting %s [%s]:%d ",
347 Msg->IO.ConnectMe->Port);
348 Msg->IO.NextState = eConnect;
351 /*****************************************************************************
352 * So we connect our Relay IP here. *
353 *****************************************************************************/
354 eNextState mx_connect_ip(AsyncIO *IO)
356 SmtpOutMsg *Msg = IO->Data;
358 EVS_syslog(LOG_DEBUG, "SMTP: %s\n", __FUNCTION__);
360 IO->ConnectMe = Msg->pCurrRelay;
361 Msg->State = eConnectMX;
363 SetConnectStatus(IO);
365 return EvConnectSock(IO,
367 SMTP_C_ReadTimeouts[0],
371 eNextState get_one_mx_host_ip_done(AsyncIO *IO)
373 SmtpOutMsg *Msg = IO->Data;
374 struct hostent *hostent;
377 EVS_syslog(LOG_DEBUG, "SMTP: %s Time[%fs]\n",
379 IO->Now - IO->DNS.Start);
381 hostent = Msg->HostLookup.VParsedDNSReply;
382 if ((Msg->HostLookup.DNSStatus == ARES_SUCCESS) &&
383 (hostent != NULL) ) {
384 memset(&Msg->pCurrRelay->Addr, 0, sizeof(struct in6_addr));
385 if (Msg->pCurrRelay->IPv6) {
386 memcpy(&Msg->pCurrRelay->Addr.sin6_addr.s6_addr,
387 &hostent->h_addr_list[0],
388 sizeof(struct in6_addr));
390 Msg->pCurrRelay->Addr.sin6_family =
392 Msg->pCurrRelay->Addr.sin6_port =
393 htons(DefaultMXPort);
396 struct sockaddr_in *addr;
398 * Bypass the ns lookup result like this:
399 * IO->Addr.sin_addr.s_addr = inet_addr("127.0.0.1");
400 * addr->sin_addr.s_addr =
401 * htonl((uint32_t)&hostent->h_addr_list[0]);
404 addr = (struct sockaddr_in*) &Msg->pCurrRelay->Addr;
406 memcpy(&addr->sin_addr.s_addr,
407 hostent->h_addr_list[0],
410 addr->sin_family = hostent->h_addrtype;
411 addr->sin_port = htons(DefaultMXPort);
413 Msg->mx_host = Msg->pCurrRelay->Host;
414 if (Msg->HostLookup.VParsedDNSReply != NULL) {
415 Msg->HostLookup.DNSReplyFree(Msg->HostLookup.VParsedDNSReply);
416 Msg->HostLookup.VParsedDNSReply = NULL;
418 return mx_connect_ip(IO);
421 if (Msg->HostLookup.VParsedDNSReply != NULL) {
422 Msg->HostLookup.DNSReplyFree(Msg->HostLookup.VParsedDNSReply);
423 Msg->HostLookup.VParsedDNSReply = NULL;
425 return FailOneAttempt(IO);
429 eNextState get_one_mx_host_ip(AsyncIO *IO)
431 SmtpOutMsg * Msg = IO->Data;
433 * here we start with the lookup of one host. it might be...
434 * - the relay host *sigh*
435 * - the direct hostname if there was no mx record
439 EVS_syslog(LOG_DEBUG, "SMTP: %s\n", __FUNCTION__);
441 EVS_syslog(LOG_DEBUG,
442 "SMTP client[%ld]: looking up %s-Record %s : %d ...\n",
444 (Msg->pCurrRelay->IPv6)? "aaaa": "a",
445 Msg->pCurrRelay->Host,
446 Msg->pCurrRelay->Port);
448 if (!QueueQuery((Msg->pCurrRelay->IPv6)? ns_t_aaaa : ns_t_a,
449 Msg->pCurrRelay->Host,
452 get_one_mx_host_ip_done))
454 Msg->MyQEntry->Status = 5;
455 StrBufPrintf(Msg->MyQEntry->StatusMessage,
456 "No MX hosts found for <%s>", Msg->node);
457 Msg->IO.NextState = eTerminateConnection;
458 return IO->NextState;
460 IO->NextState = eReadDNSReply;
461 return IO->NextState;
465 /*****************************************************************************
466 * here we try to find out about the MX records for our recipients. *
467 *****************************************************************************/
468 eNextState smtp_resolve_mx_record_done(AsyncIO *IO)
470 SmtpOutMsg * Msg = IO->Data;
475 EVS_syslog(LOG_DEBUG, "SMTP: %s Time[%fs]\n",
477 IO->Now - IO->DNS.Start);
480 while ((pp != NULL) && (*pp != NULL) && ((*pp)->Next != NULL))
483 if ((IO->DNS.Query->DNSStatus == ARES_SUCCESS) &&
484 (IO->DNS.Query->VParsedDNSReply != NULL))
485 { /* ok, we found mx records. */
489 = IO->DNS.Query->VParsedDNSReply;
490 while (Msg->CurrMX) {
492 for (i = 0; i < 2; i++) {
495 p = (ParsedURL*) malloc(sizeof(ParsedURL));
496 memset(p, 0, sizeof(ParsedURL));
497 p->Priority = Msg->CurrMX->priority;
499 p->Port = DefaultMXPort;
501 p->Host = Msg->CurrMX->host;
505 ParsedURL *ppp = *pp;
507 while ((ppp->Next != NULL) &&
508 (ppp->Next->Priority <= p->Priority))
511 (ppp->Priority > p->Priority)) {
521 Msg->CurrMX = Msg->CurrMX->next;
523 Msg->CXFlags = Msg->CXFlags & F_HAVE_MX;
525 else { /* else fall back to the plain hostname */
527 for (i = 0; i < 2; i++) {
530 p = (ParsedURL*) malloc(sizeof(ParsedURL));
531 memset(p, 0, sizeof(ParsedURL));
533 p->Port = DefaultMXPort;
540 Msg->CXFlags = Msg->CXFlags & F_DIRECT;
542 if (Msg->MyQItem->FallBackHost != NULL)
544 Msg->MyQItem->FallBackHost->Next = *pp;
545 *pp = Msg->MyQItem->FallBackHost;
547 Msg->pCurrRelay = Msg->Relay;
548 return get_one_mx_host_ip(IO);
551 eNextState resolve_mx_records(AsyncIO *IO)
553 SmtpOutMsg * Msg = IO->Data;
555 EVS_syslog(LOG_DEBUG, "SMTP: %s\n", __FUNCTION__);
556 /* start resolving MX records here. */
557 if (!QueueQuery(ns_t_mx,
561 smtp_resolve_mx_record_done))
563 Msg->MyQEntry->Status = 5;
564 StrBufPrintf(Msg->MyQEntry->StatusMessage,
565 "No MX hosts found for <%s>", Msg->node);
566 return IO->NextState;
568 Msg->IO.NextState = eReadDNSReply;
569 return IO->NextState;
574 /******************************************************************************
575 * so, we're going to start a SMTP delivery. lets get it on. *
576 ******************************************************************************/
578 SmtpOutMsg *new_smtp_outmsg(OneQueItem *MyQItem,
579 MailQEntry *MyQEntry,
584 Msg = (SmtpOutMsg *) malloc(sizeof(SmtpOutMsg));
585 memset(Msg, 0, sizeof(SmtpOutMsg));
588 Msg->MyQEntry = MyQEntry;
589 Msg->MyQItem = MyQItem;
590 Msg->pCurrRelay = MyQItem->URL;
592 InitIOStruct(&Msg->IO,
595 SMTP_C_ReadServerStatus,
597 SMTP_C_DispatchWriteDone,
598 SMTP_C_DispatchReadDone,
605 Msg->IO.ErrMsg = Msg->MyQEntry->StatusMessage;
610 void smtp_try_one_queue_entry(OneQueItem *MyQItem,
611 MailQEntry *MyQEntry,
613 /*KeepMsgText allows us to use MsgText as ours.*/
619 syslog(LOG_DEBUG, "SMTP: %s\n", __FUNCTION__);
621 Msg = new_smtp_outmsg(MyQItem, MyQEntry, MsgCount);
622 if (KeepMsgText) Msg->msgtext = MsgText;
623 else Msg->msgtext = NewStrBufDup(MsgText);
625 if (smtp_resolve_recipients(Msg)) {
628 ((CitContext *)Msg->IO.CitContext)->cs_host,
630 sizeof(((CitContext *)
631 Msg->IO.CitContext)->cs_host));
633 syslog(LOG_DEBUG, "SMTP Starting: [%ld] <%s> CC <%d> \n",
634 Msg->MyQItem->MessageID,
635 ChrPtr(Msg->MyQEntry->Recipient),
636 ((CitContext*)Msg->IO.CitContext)->cs_pid);
637 if (Msg->pCurrRelay == NULL)
638 QueueEventContext(&Msg->IO,
640 else { /* oh... via relay host */
641 if (Msg->pCurrRelay->IsIP) {
642 QueueEventContext(&Msg->IO,
646 /* uneducated admin has chosen to
647 add DNS to the equation... */
648 QueueEventContext(&Msg->IO,
654 /* No recipients? well fail then. */
656 (Msg->MyQEntry == NULL)) {
657 Msg->MyQEntry->Status = 5;
658 StrBufPlain(Msg->MyQEntry->StatusMessage,
659 HKEY("Invalid Recipient!"));
661 FinalizeMessageSend_1(&Msg->IO);
662 FinalizeMessageSend_DB_1(&Msg->IO);
663 FinalizeMessageSend_DB_2(&Msg->IO);
664 FinalizeMessageSend_DB_3(&Msg->IO);
665 FinalizeMessageSend_DB(&Msg->IO);
674 /*****************************************************************************/
675 /* SMTP CLIENT DISPATCHER */
676 /*****************************************************************************/
678 void SMTPSetTimeout(eNextState NextTCPState, SmtpOutMsg *Msg)
680 double Timeout = 0.0;
681 AsyncIO *IO = &Msg->IO;
683 EVS_syslog(LOG_DEBUG, "SMTP: %s\n", __FUNCTION__);
685 switch (NextTCPState) {
689 Timeout = SMTP_C_SendTimeouts[Msg->State];
690 if (Msg->State == eDATABody) {
691 /* if we're sending a huge message,
694 Timeout += StrLength(Msg->msgtext) / 512;
698 Timeout = SMTP_C_ReadTimeouts[Msg->State];
699 if (Msg->State == eDATATerminateBody) {
701 * some mailservers take a nap before accepting
702 * the message content inspection and such.
704 Timeout += StrLength(Msg->msgtext) / 512;
714 case eTerminateConnection:
718 SetNextTimeout(&Msg->IO, Timeout);
720 eNextState SMTP_C_DispatchReadDone(AsyncIO *IO)
722 EVS_syslog(LOG_DEBUG, "SMTP: %s\n", __FUNCTION__);
723 SmtpOutMsg *Msg = IO->Data;
726 rc = ReadHandlers[Msg->State](Msg);
730 SMTPSetTimeout(rc, Msg);
734 eNextState SMTP_C_DispatchWriteDone(AsyncIO *IO)
736 EVS_syslog(LOG_DEBUG, "SMTP: %s\n", __FUNCTION__);
737 SmtpOutMsg *Msg = IO->Data;
740 rc = SendHandlers[Msg->State](Msg);
741 SMTPSetTimeout(rc, Msg);
746 /*****************************************************************************/
747 /* SMTP CLIENT ERROR CATCHERS */
748 /*****************************************************************************/
749 eNextState SMTP_C_Terminate(AsyncIO *IO)
751 SmtpOutMsg *Msg = IO->Data;
753 EVS_syslog(LOG_DEBUG, "SMTP: %s\n", __FUNCTION__);
754 return FinalizeMessageSend(Msg);
756 eNextState SMTP_C_TerminateDB(AsyncIO *IO)
758 EVS_syslog(LOG_DEBUG, "SMTP: %s\n", __FUNCTION__);
759 return FinalizeMessageSend_DB(IO);
761 eNextState SMTP_C_Timeout(AsyncIO *IO)
763 SmtpOutMsg *Msg = IO->Data;
765 Msg->MyQEntry->Status = 4;
766 EVS_syslog(LOG_DEBUG, "SMTP: %s\n", __FUNCTION__);
767 StrBufPlain(IO->ErrMsg, CKEY(ReadErrors[Msg->State]));
768 if (Msg->State > eRCPT)
771 return FailOneAttempt(IO);
773 eNextState SMTP_C_ConnFail(AsyncIO *IO)
775 SmtpOutMsg *Msg = IO->Data;
777 Msg->MyQEntry->Status = 4;
778 EVS_syslog(LOG_DEBUG, "SMTP: %s\n", __FUNCTION__);
779 StrBufPlain(IO->ErrMsg, CKEY(ReadErrors[Msg->State]));
780 return FailOneAttempt(IO);
782 eNextState SMTP_C_DNSFail(AsyncIO *IO)
784 SmtpOutMsg *Msg = IO->Data;
785 Msg->MyQEntry->Status = 4;
786 EVS_syslog(LOG_DEBUG, "SMTP: %s\n", __FUNCTION__);
787 return FailOneAttempt(IO);
789 eNextState SMTP_C_Shutdown(AsyncIO *IO)
791 EVS_syslog(LOG_DEBUG, "SMTP: %s\n", __FUNCTION__);
792 SmtpOutMsg *Msg = IO->Data;
794 Msg->MyQEntry->Status = 3;
795 StrBufPlain(Msg->MyQEntry->StatusMessage,
796 HKEY("server shutdown during message submit."));
797 return FinalizeMessageSend(Msg);
802 * @brief lineread Handler;
803 * understands when to read more SMTP lines, and when this is a one-lined reply.
805 eReadState SMTP_C_ReadServerStatus(AsyncIO *IO)
807 eReadState Finished = eBufferNotEmpty;
809 while (Finished == eBufferNotEmpty) {
810 Finished = StrBufChunkSipLine(IO->IOBuf, &IO->RecvBuf);
813 case eMustReadMore: /// read new from socket...
816 case eBufferNotEmpty: /* shouldn't happen... */
817 case eReadSuccess: /// done for now...
818 if (StrLength(IO->IOBuf) < 4)
820 if (ChrPtr(IO->IOBuf)[3] == '-')
821 Finished = eBufferNotEmpty;
825 case eReadFail: /// WHUT?
833 void LogDebugEnableSMTPClient(void)
835 SMTPClientDebugEnabled = 1;
838 CTDL_MODULE_INIT(smtp_eventclient)
841 CtdlRegisterDebugFlagHook(HKEY("smtpeventclient"), LogDebugEnableSMTPClient);
842 return "smtpeventclient";