Build Mail app extensions

RSS for tag

Discuss the WWDC21 session Build Mail app extensions.

Posts under wwdc21-10168 tag

17 Posts

Post

Replies

Boosts

Views

Activity

Feature Requests
As long time Mail plugin developer (11 years) I really welcome the addition of extensions for Mail. Unfortunately for now the feature set is very minimal and will only help us to implement a minimal viable version of our product if we switch to it. Is the current API set in stone for macOS Monterey or does it make sense to send feature requests? If so, where it the best place to post them? Here or via Radar? Thanks!
3
0
2.4k
Jun ’23
MEComposeSessionHandler alert message not shown
When the mail extension invoke allowMessageSendForSession func, the error prompt did not show the error description. What am I missing? Below is the code:     enum ComposeSessionError: LocalizedError {         case invalidRecipientDomain                  var errorDescription: String? {             switch self {             case .invalidRecipientDomain:                 return "example.com is not a valid recipient domain"             }         }     }          func allowMessageSendForSession(_ session: MEComposeSession) async throws {         // Before Mail sends a message, your extension can validate the         // contents of the compose session. If the message isn't ready to be         // sent, throw an error.         throw ComposeSessionError.invalidRecipientDomain     }
6
0
2.7k
May ’22
Compose Mail Extension - User Privacy Permissions
I'm trying to build a simple Mail Extension using Compose session handler for the Mac Catalyst App. The idea is to open a ComposeViewController on App Icon click from Mail Toolbar ( when the user adds the app extensions for the app from Mail Preference ). I'm using core data in a shared group and I want to show the list of the email address that the user has added from the app to the ComposeViewController. But on the extension window in the Mail, it shows : Permissions for “MyDemoApp”: • Email Contents Can read sensitive information from emails including the message subject and recipients. This applies to all outgoing messages. Since my Compose-Mail-Extension does not read subject/recipients in the Compose window, My app should not ask this permission from users. Is there any way to omit permissions which my app is not using?
1
0
1.3k
May ’22
MailKit: access rawData for email
Hi, I am trying to build a Mail 'action' extension, and want to access the email body and parse it for specific content. Not sure how to go about converting the 'rawData' that comes in the MEMessage into something that I can read. Here's how I access the rawData property: func decideAction(for message: MEMessage, completionHandler: @escaping (MEMessageActionDecision?) -> Void) { var action: MEMessageActionDecision? = nil      if let messageData =  message.rawData {          print("messageData = \(messageData)") // what to do here??      } else {          action = MEMessageActionDecision.invokeAgainWithBody      } return action } The documentation just says this is 'unprocessed data': The content is available after MailKit downloads the message. MailKit provides the content as unprocessed data. For details about the format of the data, see RFC 2822. But I'm not sure what I'm supposed to do to go about converting the unprocessed 'data' into something that is accessible and useful to my app. Let me know if you have any thoughts or recommendations
2
0
1.7k
Apr ’22
Creating an attachment in encode(_:, composeContext:)
It seems that the mail app sets its mail headers after additionalHeaders(for:) is called, overwriting standard headers set by the extension, such as Content-Type. It also seems the Mail app decides whether an email is of content type text/plain or multipart/alternative;  boundary="Apple-Mail=[...]" based on the user input. If the user only inputs plain text (i.e. using no font formatting options or adding an attachment) then Content-Type will always default to text/plain. This causes an issue in encode(_:, composeContext:) if the signature should be included as an attachment. First of all, it seems impossible to force Mail to set Content-Type to multipart/alternative and even if the message is set to multipart/alternative (e.g. b/c the user made text bold), the ecode method doesn't know the boundary string set by Apple mail (Apple-Mail=[hash]). Is there a way to create an attachment in encode?
1
0
693
Jan ’22
Mail Extension for Creating Signature
Hi, I have an application which adds custom signature to Signature tab of the Mail Preference window based on the inputs entered (first name , last name , Designation,Phone , address etc etc....). I’m wondering if the new Mail Extension can be used to do signatures more ‘natively’. Can MEComposeSessionHandler be used for this? Please help. Thanks In Advance. Regards, Neetha
2
0
1.4k
Jan ’22
Setting or injecting mail signatures
Hi All Is there a way to assign an email signature through the MECompose class? This process already working for gmail accounts, signatures settings can be set from an api provided by google. For outlook there is an AddIn that supports injecting a signature upon composing a mail. Now that extensions have come up for monterey, I wonder if they provided a way to do it for the mac mail app as well through the Mail Extension service. An example of what I want (to be able to do either of this 2 options) after pressing the extension (better solution to do it automatically just by this extension to be installed): Set a new signature name, for example 'Work' if it doesn't exist and fetch a signature from a REST API and edit it there. Upon composing new mail fetch a signature through REST API and set/replace the current signature with the one returned. Is it possible with the new Mail Extension package? It would also be nice for a short snippet of how to start with this. Regards, Shlomi
0
0
567
Dec ’21
MailKit API Documentation
Does any have anyone have documentation on the usage related to the forMessageContext and messageContext parameters and for the methods below? This is undocumented while public making it an unusable API. func extensionViewController(messageContext: Data) -> MEExtensionViewController? func primaryActionClicked(forMessageContext context: Data) async -> MEExtensionViewController? The APIs are located here but lack any kind of proper documentation and examples https://developer.apple.com/documentation/mailkit/memessagesecurityhandler/3882908-extensionviewcontroller
0
0
977
Nov ’21
Unable to construct MEDecodedMessage since Monterey Beta 7
I've already created feedback id FB9647811 about this, but as there has been no response to that I was wondering if anyone else had experienced the same or found a fix. My extension was working until Monterey beta 7 but now it crashes with the following message: [MEDecodedMessage initWithData:securityInformation:]: unrecognized selector sent to instance According to the documentation this is the correct constructor.
1
0
1k
Nov ’21
Feature Requests
As long time Mail plugin developer (11 years) I really welcome the addition of extensions for Mail. Unfortunately for now the feature set is very minimal and will only help us to implement a minimal viable version of our product if we switch to it. Is the current API set in stone for macOS Monterey or does it make sense to send feature requests? If so, where it the best place to post them? Here or via Radar? Thanks!
Replies
3
Boosts
0
Views
2.4k
Activity
Jun ’23
MEComposeSessionHandler alert message not shown
When the mail extension invoke allowMessageSendForSession func, the error prompt did not show the error description. What am I missing? Below is the code:     enum ComposeSessionError: LocalizedError {         case invalidRecipientDomain                  var errorDescription: String? {             switch self {             case .invalidRecipientDomain:                 return "example.com is not a valid recipient domain"             }         }     }          func allowMessageSendForSession(_ session: MEComposeSession) async throws {         // Before Mail sends a message, your extension can validate the         // contents of the compose session. If the message isn't ready to be         // sent, throw an error.         throw ComposeSessionError.invalidRecipientDomain     }
Replies
6
Boosts
0
Views
2.7k
Activity
May ’22
Compose Mail Extension - User Privacy Permissions
I'm trying to build a simple Mail Extension using Compose session handler for the Mac Catalyst App. The idea is to open a ComposeViewController on App Icon click from Mail Toolbar ( when the user adds the app extensions for the app from Mail Preference ). I'm using core data in a shared group and I want to show the list of the email address that the user has added from the app to the ComposeViewController. But on the extension window in the Mail, it shows : Permissions for “MyDemoApp”: • Email Contents Can read sensitive information from emails including the message subject and recipients. This applies to all outgoing messages. Since my Compose-Mail-Extension does not read subject/recipients in the Compose window, My app should not ask this permission from users. Is there any way to omit permissions which my app is not using?
Replies
1
Boosts
0
Views
1.3k
Activity
May ’22
MailKit: access rawData for email
Hi, I am trying to build a Mail 'action' extension, and want to access the email body and parse it for specific content. Not sure how to go about converting the 'rawData' that comes in the MEMessage into something that I can read. Here's how I access the rawData property: func decideAction(for message: MEMessage, completionHandler: @escaping (MEMessageActionDecision?) -> Void) { var action: MEMessageActionDecision? = nil      if let messageData =  message.rawData {          print("messageData = \(messageData)") // what to do here??      } else {          action = MEMessageActionDecision.invokeAgainWithBody      } return action } The documentation just says this is 'unprocessed data': The content is available after MailKit downloads the message. MailKit provides the content as unprocessed data. For details about the format of the data, see RFC 2822. But I'm not sure what I'm supposed to do to go about converting the unprocessed 'data' into something that is accessible and useful to my app. Let me know if you have any thoughts or recommendations
Replies
2
Boosts
0
Views
1.7k
Activity
Apr ’22
Creating an attachment in encode(_:, composeContext:)
It seems that the mail app sets its mail headers after additionalHeaders(for:) is called, overwriting standard headers set by the extension, such as Content-Type. It also seems the Mail app decides whether an email is of content type text/plain or multipart/alternative;  boundary="Apple-Mail=[...]" based on the user input. If the user only inputs plain text (i.e. using no font formatting options or adding an attachment) then Content-Type will always default to text/plain. This causes an issue in encode(_:, composeContext:) if the signature should be included as an attachment. First of all, it seems impossible to force Mail to set Content-Type to multipart/alternative and even if the message is set to multipart/alternative (e.g. b/c the user made text bold), the ecode method doesn't know the boundary string set by Apple mail (Apple-Mail=[hash]). Is there a way to create an attachment in encode?
Replies
1
Boosts
0
Views
693
Activity
Jan ’22
Mail Extension project template not shown
Hi I have installed the latest XCode 13.2, including updating the developer components but still I do not see the Mail Extension template when starting a new project like shown in the tutorial, what am I doing wrong? Do I need to install it manually? I do not see any reference about it anywhere.
Replies
3
Boosts
0
Views
1.3k
Activity
Jan ’22
Mail Extension for Creating Signature
Hi, I have an application which adds custom signature to Signature tab of the Mail Preference window based on the inputs entered (first name , last name , Designation,Phone , address etc etc....). I’m wondering if the new Mail Extension can be used to do signatures more ‘natively’. Can MEComposeSessionHandler be used for this? Please help. Thanks In Advance. Regards, Neetha
Replies
2
Boosts
0
Views
1.4k
Activity
Jan ’22
Setting or injecting mail signatures
Hi All Is there a way to assign an email signature through the MECompose class? This process already working for gmail accounts, signatures settings can be set from an api provided by google. For outlook there is an AddIn that supports injecting a signature upon composing a mail. Now that extensions have come up for monterey, I wonder if they provided a way to do it for the mac mail app as well through the Mail Extension service. An example of what I want (to be able to do either of this 2 options) after pressing the extension (better solution to do it automatically just by this extension to be installed): Set a new signature name, for example 'Work' if it doesn't exist and fetch a signature from a REST API and edit it there. Upon composing new mail fetch a signature through REST API and set/replace the current signature with the one returned. Is it possible with the new Mail Extension package? It would also be nice for a short snippet of how to start with this. Regards, Shlomi
Replies
0
Boosts
0
Views
567
Activity
Dec ’21
mail app crash on catalina 10.15
terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'V3->V4 migrator must be run before persistence version can be migrated to V5' terminating with uncaught exception of type NSException abort() called How to run migrator/ how to fix this issue?
Replies
0
Boosts
0
Views
546
Activity
Nov ’21
MailKit API Documentation
Does any have anyone have documentation on the usage related to the forMessageContext and messageContext parameters and for the methods below? This is undocumented while public making it an unusable API. func extensionViewController(messageContext: Data) -> MEExtensionViewController? func primaryActionClicked(forMessageContext context: Data) async -> MEExtensionViewController? The APIs are located here but lack any kind of proper documentation and examples https://developer.apple.com/documentation/mailkit/memessagesecurityhandler/3882908-extensionviewcontroller
Replies
0
Boosts
0
Views
977
Activity
Nov ’21
Unable to construct MEDecodedMessage since Monterey Beta 7
I've already created feedback id FB9647811 about this, but as there has been no response to that I was wondering if anyone else had experienced the same or found a fix. My extension was working until Monterey beta 7 but now it crashes with the following message: [MEDecodedMessage initWithData:securityInformation:]: unrecognized selector sent to instance According to the documentation this is the correct constructor.
Replies
1
Boosts
0
Views
1k
Activity
Nov ’21
Issue in Mailto url encoding in latest iOS version
Hello, I am not able to use or \n to take a new line in the email body in the default iOS mail application. Example: mailto:abc@gmailDOTcom?subject=test&body=Hello,mailBody Result in latest iOS mail app: Hello,mailBody Expected result: Hello, mailBody Will you please help me to resolve this issue?
Replies
2
Boosts
0
Views
1.4k
Activity
Nov ’21