Unicode C
Unicode C
Create an Inline-Forward Email
See more Email Object Examples
Demonstrates the Chilkat Email.ToForward method, which creates an inline-forward email based on this email. The forward is returned in the argument, and the source email is not modified. The returned email can be edited — adding recipients, prepending a note — before sending. This example forwards a message and adds a recipient.
Background: An inline forward quotes the original message's content within the body of the new message — the familiar "---------- Forwarded message ----------" style — as opposed to attaching the original as a
message/rfc822 part (which AttachEmail does). Chilkat assembles the quoted body and headers for you, leaving the new message ready to address and send.Chilkat Unicode C Downloads
#include <C_CkEmailW.h>
void ChilkatSample(void)
{
BOOL success;
HCkEmailW email;
HCkEmailW fwd;
success = FALSE;
// Demonstrates the ToForward method, which creates an inline-forward email based on this
// email. The forward is returned in the argument; the source email is not modified.
email = CkEmailW_Create();
CkEmailW_putSubject(email,L"Quarterly results");
CkEmailW_putFrom(email,L"alice@example.com");
CkEmailW_AddTo(email,L"Bob",L"bob@example.com");
CkEmailW_putBody(email,L"Here are the quarterly results.");
// Create an inline-forward email from this message.
fwd = CkEmailW_Create();
success = CkEmailW_ToForward(email,fwd);
if (success == FALSE) {
wprintf(L"%s\n",CkEmailW_lastErrorText(email));
CkEmailW_Dispose(email);
CkEmailW_Dispose(fwd);
return true;
}
// The forward can be edited to add recipients before sending.
CkEmailW_AddTo(fwd,L"Carol",L"carol@example.com");
wprintf(L"%s\n",CkEmailW_getMime(fwd));
CkEmailW_Dispose(email);
CkEmailW_Dispose(fwd);
}