Question on Mailkit API

Hi,

So far in my knowledge of the Mailkit API, a security handler’s encode method is the only place I can alter the RFC 822 data of an email (https://developer.apple.com/documentation/mailkit/memessageencoder/3882902-encode), Any other interface method that gives access to the message data gives a read only access. Can Please confirm if the same understanding is incorrect?

Encode method, as the below documentation claims, is supposed to be called once, when the message is sent, but I can see that my extension’s encode method is being called several times during composing of an email. Is this a bug?

/// @brief This is invoked when an outgoing message is sent. The supplied @c message will contain the email address of the sender, the recipient email addresses, and the message data being sent. The completion handler should be called with the @c result of applying any encoding if needed based on @c shouldSign and @c shouldEncrypt. If the @c result is not encrypted or signed and does not have any errors, it is assumed the message did not need a signature or encryption applied. In this case the @c data for the result will be ignored.

/// @param message - The outgoing message to apply any security mechanisms on.

/// @param composeContext - @c MEComposeContext instance which corresponds to the @c message being composed.

  • (void)encodeMessage:(MEMessage *)message composeContext:(MEComposeContext *)composeContext completionHandler:(void (^)(MEMessageEncodingResult *result))completionHandler;

I also noticed that mailComposeSessionDidBegin from ComposeSessionHandler is getting called but mailComposeSessionDidEnd isn't when I close the compose window of an email or hit send button. Is this also a bug?