C
C
MIME CurrentDateTime Property
See more MIME Examples
Demonstrates the read-only CurrentDateTime property, which returns the current local date and time formatted as an Internet message date including the numeric UTC offset. The example uses it to populate a Date header field.
Background. Internet message dates follow the RFC 5322 format, for example
Fri, 21 Nov 1997 09:55:06 -0600. CurrentDateTime produces a value in that form for use in message headers.Chilkat C Downloads
#include <C_CkMime.h>
void ChilkatSample(void)
{
BOOL success;
HCkMime mime;
const char *now;
const char *head;
success = FALSE;
mime = CkMime_Create();
success = CkMime_SetBodyFromPlainText(mime,"Message with a Date header.");
if (success == FALSE) {
printf("%s\n",CkMime_lastErrorText(mime));
CkMime_Dispose(mime);
return;
}
// CurrentDateTime returns the current local date and time formatted as an Internet message date,
// including the numeric UTC offset, for example: Fri, 21 Nov 1997 09:55:06 -0600
now = CkMime_currentDateTime(mime);
printf("Current date/time: %s\n",now);
// It can be used to populate a Date header field.
CkMime_SetHeaderField(mime,"Date",now);
head = CkMime_getEntireHead(mime);
if (CkMime_getLastMethodSuccess(mime) == FALSE) {
printf("%s\n",CkMime_lastErrorText(mime));
CkMime_Dispose(mime);
return;
}
printf("%s\n",head);
CkMime_Dispose(mime);
}