eSMTP_C_States State;
- int SMTPstatus;
+/// int SMTPstatus; ->MyQEntry->Status
int i_mx;
int n_mx;
void *vHandler;
StrBufExtract_NextToken(Line, RawQItem, &pLine, '\n');
+ if (StrLength(Line) == 0) continue;
StrBufExtract_NextToken(Token, Line, &pItemPart, '|');
if (GetHash(QItemHandlers, SKEY(Token), &vHandler))
{
}
/// TODO : else free message...
+ close(Msg->IO.sock);
DeleteSmtpOutMsg(Msg);
}
CtdlLogPrintf(CTDL_DEBUG, "SMTP client[%ld]: Number of MX hosts for <%s> is %d [%s]\n",
SendMsg->n, SendMsg->node, SendMsg->num_mxhosts, SendMsg->mxhosts);
if (SendMsg->num_mxhosts < 1) {
- SendMsg->SMTPstatus = 5;
+ SendMsg->MyQEntry->Status = 5;
StrBufPrintf(SendMsg->MyQEntry->StatusMessage,
"No MX hosts found for <%s>", SendMsg->node);
return; ///////TODO: abort!
}
/* TODO: abort... */
-#define SMTP_ERROR(WHICH_ERR, ERRSTR) {SendMsg->SMTPstatus = WHICH_ERR; StrBufAppendBufPlain(SendMsg->MyQEntry->StatusMessage, HKEY(ERRSTR), 0); return eAbort; }
-#define SMTP_VERROR(WHICH_ERR) { SendMsg->SMTPstatus = WHICH_ERR; StrBufAppendBufPlain(SendMsg->MyQEntry->StatusMessage, &ChrPtr(SendMsg->IO.IOBuf)[4], -1, 0); return eAbort; }
+#define SMTP_ERROR(WHICH_ERR, ERRSTR) {SendMsg->MyQEntry->Status = WHICH_ERR; StrBufAppendBufPlain(SendMsg->MyQEntry->StatusMessage, HKEY(ERRSTR), 0); return eAbort; }
+#define SMTP_VERROR(WHICH_ERR) { SendMsg->MyQEntry->Status = WHICH_ERR; StrBufAppendBufPlain(SendMsg->MyQEntry->StatusMessage, &ChrPtr(SendMsg->IO.IOBuf)[4], -1, 0); return eAbort; }
#define SMTP_IS_STATE(WHICH_STATE) (ChrPtr(SendMsg->IO.IOBuf)[0] == WHICH_STATE)
#define SMTP_DBG_SEND() CtdlLogPrintf(CTDL_DEBUG, "SMTP client[%ld]: > %s\n", SendMsg->n, ChrPtr(SendMsg->IO.IOBuf))
}
/// hier: naechsten mx ausprobieren.
if (SendMsg->IO.sock < 0) {
- SendMsg->SMTPstatus = 4; /* dsn is already filled in */
+ SendMsg->MyQEntry->Status = 4; /* dsn is already filled in */
//// hier: abbrechen & bounce.
return -1;
}
StrBufPlain(SendMsg->MyQEntry->StatusMessage,
&ChrPtr(SendMsg->IO.RecvBuf.Buf)[4],
StrLength(SendMsg->IO.RecvBuf.Buf) - 4);
- SendMsg->SMTPstatus = 2;
+ SendMsg->MyQEntry->Status = 2;
return eSendReply;
}
SendMsg->n = MsgCount++;
SendMsg->MyQEntry = MyQEntry;
SendMsg->MyQItem = MyQItem;
- SendMsg->msgtext = MsgText;
+ if (KeepMsgText)
+ SendMsg->msgtext = MsgText;
+ else
+ SendMsg->msgtext = NewStrBufDup(MsgText);
smtp_resolve_recipients(SendMsg);
resolve_mx_hosts(SendMsg);
StrBufExtract_NextToken(Item->Current->Recipient, Line, Pos, '|');
Item->Current->Status = StrBufExtractNext_int(Line, Pos, '|');
StrBufExtract_NextToken(Item->Current->StatusMessage, Line, Pos, '|');
+ Item->Current = NULL; // TODO: is this always right?
}
MyQItem = DeserializeQueueItem(PlainQItem, msgnum);
FreeStrBuf(&PlainQItem);
- if (MyQItem == NULL)
+ if (MyQItem == NULL) {
+ CtdlLogPrintf(CTDL_ERR, "SMTP client: Msg No %ld: already in progress!\n", msgnum);
return; /* s.b. else is already processing... */
-
+ }
/*
* Postpone delivery if we've already tried recently.