Delphi DLL
Delphi DLL
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 Delphi DLL Downloads
var
success: Boolean;
mime: HCkMime;
html: PWideChar;
begin
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 := CkMime_Create();
html := '<html><body><h1>Hello</h1><p>This is an HTML body.</p></body></html>';
success := CkMime_SetBodyFromHtml(mime,html);
if (success = False) then
begin
Memo1.Lines.Add(CkMime__lastErrorText(mime));
Exit;
end;
Memo1.Lines.Add('Content-Type: ' + CkMime__contentType(mime));
CkMime_Dispose(mime);