Cloud Mail 2020 C++ Builder Edition

Questions / Feedback?

CreateDraft Method

Creates a new email draft.

Syntax

void __fastcall CreateDraft(int DraftType, String id);

Remarks

This method creates a new draft in the Drafts folder. The created message's information, including the draft's message id, is also added to the MessageInfo* properties. As a note, this will not clear the properties but will add it to the end.

Valid values for DraftType :

0DRAFTTYPE_MESSAGE
1DRAFTTYPE_REPLY
2DRAFTTYPE_REPLYALL
3DRAFTTYPE_FORWARD

Important Notes

When using DRAFTTYPE_MESSAGE, pass in an empty string as the id. The created draft will be built using the Message* properties (i.e. MessageTo, MessageSubject, MessageFrom, etc.).

When using DRAFTTYPE_REPLY, DRAFTTYPE_REPLYALL, or DRAFTTYPE_FORWARD the id parameter can be used to specify the message that is being replied to or forwarded. Also, the created draft will NOT be built with the Message* properties. Instead, the created draft will be empty (except for the From field). The Update method can be used instead to fill in the different parts of the message.

Example (New Draft)


// Create a draft message
office365.MessageSubject = "Subject Text";
office365.MessageImportance = "High";
office365.MessageBodyContentType = "TEXT";
office365.MessageBodyContent = "Body Text";
office365.MessageTo = "email@example.com";

office365.CreateDraft(0, "");
office365.SendDraft(office365.MessageInfo[0].Id);
Example (Reply)


// Create the reply draft
string originalMessageId = "Message ID";
office365.CreateDraft(1, originalMessageId);

// Set the new draft MessageInfo fields with desired options
office365.MessageInfo[0].To = "email@example.com";
office365.MessageInfo[0].Subject = "Subject Text";
office365.MessageInfo[0].BodyContentType = "TEXT";
office365.MessageInfo[0].BodyContent = "Body Text";

// Update the draft
office365.Update(office365.MessageInfo[0].Id);

// Send the draft
office365.SendDraft(office365.MessageInfo[0].Id);

Copyright (c) 2022 /n software inc. - All rights reserved.
Cloud Mail 2020 C++ Builder Edition - Version 20.0 [Build 8308]