SendDraft Method

Sends an existing draft.

Syntax

public void sendDraft(String id);

Remarks

This method sends an existing draft. The id parameter takes the ID of the draft that is going to be sent. To create a draft see the CreateDraft method. As a note, the relevant collection are not cleared after the method is called. It is recommend to do so after calling this method.

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);
Example (HTML with Attachments)
office365.MessageSubject = "Subject";
office365.MessageBodyContentType = "html";
office365.MessageBodyContent = "<p>Body</p><img src='cid:test1'>";
office365.MessageTo = "email@example.com";
office365.CreateDraft(0, "");
      
string messageId = office365.MessageInfo[0].Id;

office365.MessageAttachments.Add(new OLAttachment("test picture", "./test.txt"));
office365.MessageAttachments[0].IsInline = true;
office365.MessageAttachments[0].ContentId = "test1";
office365.AddAttachment(messageId, "", "");

office365.SendDraft(messageId);

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