EmailMessage.cc

Recipients of the message. You can use operator ~= to add people to this list, or you can also use addRecipient to achieve the same result.

message.to ~= EmailRecipient("Adam D. Ruppe", "destructionator@gmail.com");
message.cc ~= EmailRecipient("John Doe", "john.doe@example.com");
// or, same result as the above two lines:
message.addRecipient("Adam D. Ruppe", "destructionator@gmail.com");
message.addRecipient("John Doe", "john.doe@example.com", ToType.cc);

// or, the old style code that still works, but is not recommended, since
// it is harder to encode properly for anything except pure ascii names:
message.to ~= `"Adam D. Ruppe" <destructionator@gmail.com>`
class EmailMessage
RecipientList cc;

Meta

History

On May 13, 2024, the types of these changed. Before, they were public string[]; plain string arrays. This put the burden of proper encoding on the user, increasing the probability of bugs. Now, they are RecipientLists - internally, an array of EmailRecipient objects, but with a wrapper to provide compatibility with the old string-based api.