void SetSMTPState(AsyncIO *IO, smtpstate State)
{
CitContext* CCC = IO->CitContext;
- memcpy(CCC->cs_clientname, SMTPStates[State].Key, SMTPStates[State].len + 1);
+ if (CCC != NULL)
+ memcpy(CCC->cs_clientname, SMTPStates[State].Key, SMTPStates[State].len + 1);
}
int SMTPClientDebugEnabled = 0;
Msg->HostLookup.DNSReplyFree(Msg->HostLookup.VParsedDNSReply);
FreeURL(&Msg->Relay);
FreeStrBuf(&Msg->msgtext);
+ FreeStrBuf(&Msg->MultiLineBuf);
FreeAsyncIOContents(&Msg->IO);
memset (Msg, 0, sizeof(SmtpOutMsg)); /* just to be shure... */
free(Msg);
Msg->MyQItem->QueMsgID = -1;
if (Msg->IDestructQueItem)
- smtpq_do_bounce(Msg->MyQItem, StatusMessage, Msg->msgtext, Msg->pCurrRelay);
+ smtpq_do_bounce(Msg->MyQItem, Msg->msgtext, Msg->pCurrRelay);
if (Msg->nRemain > 0)
{
msg->cm_magic = CTDLMESSAGE_MAGIC;
msg->cm_anon_type = MES_NORMAL;
msg->cm_format_type = FMT_RFC822;
- msg->cm_fields['M'] = SmashStrBuf(&Msg->QMsgData);
- msg->cm_fields['U'] = strdup("QMSG");
+ CM_SetAsFieldSB(msg, eMesageText, &Msg->QMsgData);
+ CM_SetField(msg, eMsgSubject, HKEY("QMSG"));
Msg->MyQItem->QueMsgID =
CtdlSubmitMsg(msg, NULL, SMTP_SPOOLOUT_ROOM, QP_EADDR);
EVS_syslog(LOG_DEBUG, "%ld", Msg->MyQItem->QueMsgID);
- CtdlFreeMessage(msg);
+ CM_Free(msg);
}
else {
CtdlDeleteMessages(SMTP_SPOOLOUT_ROOM,
eNextState FinalizeMessageSend(SmtpOutMsg *Msg)
{
/* hand over to DB Queue */
- return QueueDBOperation(&Msg->IO, FinalizeMessageSend_DB);
+ return EventQueueDBOperation(&Msg->IO, FinalizeMessageSend_DB);
}
eNextState FailOneAttempt(AsyncIO *IO)
SmtpOutMsg *Msg = IO->Data;
SetSMTPState(IO, eSTMPconnecting);
- EVS_syslog(LOG_DEBUG, "%s\n", __FUNCTION__);
+ EVS_syslog(LOG_DEBUG, "%s(%s)\n", __FUNCTION__, (Msg->IsRelay)? "Relay":"Remote");
IO->ConnectMe = Msg->pCurrRelay;
Msg->State = eConnectMX;
resolve_mx_records);
}
else { /* oh... via relay host */
+ Msg->IsRelay = 1;
if (Msg->pCurrRelay->IsIP) {
SetSMTPState(&Msg->IO, eSTMPconnecting);
QueueEventContext(&Msg->IO,
if (StrLength(IO->IOBuf) < 4)
continue;
if (ChrPtr(IO->IOBuf)[3] == '-')
+ {
+ SmtpOutMsg *Msg;
+ Msg = (SmtpOutMsg *)IO->Data;
+ if (Msg->MultiLineBuf == NULL)
+ Msg->MultiLineBuf = NewStrBuf ();
+ else
+ StrBufAppendBufPlain(Msg->MultiLineBuf, HKEY("\n"), 0);
+ StrBufAppendBuf(Msg->MultiLineBuf, IO->IOBuf, 0);
Finished = eBufferNotEmpty;
+ }
else
return Finished;
break;