Build Mail app extensions

RSS for tag

Discuss the WWDC21 session Build Mail app extensions.

Posts under wwdc21-10168 tag

22 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.6k
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
677
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
544
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
949
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
Mail app. 15.0 will not display body of email and constantly connecting to iCloud
The system is 2019 27 iMac Operating system is macOS Monterey 12.0.1 Mac Mail version 15.0 I have two email accounts set up on from gmail and on from iCloud. The gmail account works fine it's only the iCloud account that is having issues. to date I have tried rebuilding the mailbox. going into ~/library/Mail/V9/MailData/ moving Envelope Index ExternalUpdates.storedata to my desktop and deleting any other files with same name than restarting mail.  these have no affect the body of the messages will not display I have noticed that opening activity and connection doctor mail is constantly connecting to iCloud nonstop [https://drive.google.com/file/d/14_OQk3WHuOwI6hig2Bb2hSro3Urg7kdA/view?usp=sharing)
1
0
658
Oct ’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
How to restore "flagged" to Apple Mail sidebar in Monterey
I inadvertently removed the "flagged" shortcut from my Mail sidebar. How can I restore it? There is no "+" button under favorites in this version of Mail
Replies
1
Boosts
0
Views
657
Activity
May ’22
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.6k
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
Mail Extension
How can I add an icon like MEComposeIcon on my mail toolbar in spite of Compose Window?
Replies
0
Boosts
0
Views
754
Activity
Jan ’22
Add extension icon on the Mail Viewer window
With the help of MEComposeIcon I know that we can add a extension icon in the compose window. Just wanted to know how can we add the app extension on the mail main Viewer window like when we open the mail there is top toolbar which contains icon for compose mail delete mail etc. See the attached screen shot.
Replies
0
Boosts
0
Views
828
Activity
Jan ’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
677
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
544
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
533
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
949
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
MailExtension cannot block sending a mail
when I throw an exception in the func allowMessageSendForSession(_ session: MEComposeSession), the mail.app will show alert with two buttons: "cancel" and "send anyway", if I press the "send anyway" then the mail will be sent successfully! I'm wondering: how to really stop sending email? Thanks
Replies
1
Boosts
0
Views
692
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.2k
Activity
Nov ’21
Broken Sample Xcode Project Xcode 13.1
The Sample Mail App Extension project no longer builds under Xcode 13.1 due to conflicting swift and obj-c protocol method signatures
Replies
1
Boosts
0
Views
1k
Activity
Oct ’21
Mail app. 15.0 will not display body of email and constantly connecting to iCloud
The system is 2019 27 iMac Operating system is macOS Monterey 12.0.1 Mac Mail version 15.0 I have two email accounts set up on from gmail and on from iCloud. The gmail account works fine it's only the iCloud account that is having issues. to date I have tried rebuilding the mailbox. going into ~/library/Mail/V9/MailData/ moving Envelope Index ExternalUpdates.storedata to my desktop and deleting any other files with same name than restarting mail.  these have no affect the body of the messages will not display I have noticed that opening activity and connection doctor mail is constantly connecting to iCloud nonstop [https://drive.google.com/file/d/14_OQk3WHuOwI6hig2Bb2hSro3Urg7kdA/view?usp=sharing)
Replies
1
Boosts
0
Views
658
Activity
Oct ’21
Raw data is incomplete in MEMessageActionHandler
We get message rawdata from the following function: func decideActionForMessage(for message: MEMessage, completionHandler: @escaping (MEMessageActionDecision?) -> Void) But raw data is not nil, and it is incomplete, invokeAgainWithBody will not fix this problem. How can we get the entire body message?
Replies
1
Boosts
0
Views
673
Activity
Sep ’21
HTML Signature Font Issue in Apple Mail
I have added an HTML signature to the Apple Mail, whenever I hit compose the font is the same, but when I hit send and receive the email, the font changes to something of a similar version. I have used a custom font in the email signature. Why does this issue happen?
Replies
0
Boosts
0
Views
609
Activity
Aug ’21