--- smtpappender.cpp 2010-12-22 12:02:15.000000000 +0100 +++ new/smtpappender.cpp 2010-12-22 12:05:53.000000000 +0100 @@ -163,6 +163,7 @@ const LogString msg, Pool& p) { message = smtp_add_message(session); body = current = toMessage(msg, p); + messagecbState = 0; smtp_set_reverse_path(message, toAscii(from, p)); addRecipients(to, "To", p); addRecipients(cc, "Cc", p); @@ -181,6 +182,7 @@ smtp_message_t message; const char* body; const char* current; + int messagecbState; void addRecipients(const LogString& addresses, const char* field, Pool& p) { if (!addresses.empty()) { char* str = p.pstrdup(toAscii(addresses, p));; @@ -263,6 +265,10 @@ if (len == NULL) { pThis->current = pThis->body; } else { + // we are asked for headers, but we don't have any + if ((pThis->messagecbState)++ == 0) { + return NULL; + } if (pThis->current) { *len = strlen(pThis->current); }