Unicode C
Unicode C
Set a MIME Body from HTML
See more MIME Examples
Demonstrates the Chilkat Mime.SetBodyFromHtml method, which sets the body as HTML and changes the media type to text/html. The only argument is the HTML text.
Background: Setting an HTML body is how you produce the rich-formatted part of a message. Chilkat marks it
text/html and chooses the encoding based on the content — 7bit for ASCII, a charset-aware encoding otherwise. In practice an HTML email is usually paired with a plain-text alternative inside a multipart/alternative so clients that cannot render HTML still have readable text.Chilkat Unicode C Downloads
#include <C_CkMimeW.h>
void ChilkatSample(void)
{
BOOL success;
HCkMimeW mime;
const wchar_t *html;
success = FALSE;
// Demonstrates the Mime.SetBodyFromHtml method, which sets the body as HTML and changes the media
// type to text/html. The only argument is the HTML text.
mime = CkMimeW_Create();
html = L"<html><body><h1>Hello</h1><p>This is an HTML body.</p></body></html>";
success = CkMimeW_SetBodyFromHtml(mime,html);
if (success == FALSE) {
wprintf(L"%s\n",CkMimeW_lastErrorText(mime));
CkMimeW_Dispose(mime);
return;
}
wprintf(L"Content-Type: %s\n",CkMimeW_contentType(mime));
CkMimeW_Dispose(mime);
}