Build Mail app extensions

RSS for tag

Discuss the WWDC21 session Build Mail app extensions.

View Session

Posts under wwdc21-10168 tag

20 Posts
Sort by:
Post not yet marked as solved
6 Replies
1k Views
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     }
Posted Last updated
.
Post not yet marked as solved
1 Replies
201 Views
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?
Posted Last updated
.
Post not yet marked as solved
2 Replies
345 Views
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
Posted
by zulfishah.
Last updated
.
Post not yet marked as solved
0 Replies
221 Views
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.
Posted Last updated
.
Post not yet marked as solved
0 Replies
181 Views
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?
Posted Last updated
.
Post marked as solved
2 Replies
360 Views
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.
Posted
by golandsh.
Last updated
.
Post not yet marked as solved
1 Replies
612 Views
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
Posted Last updated
.
Post not yet marked as solved
0 Replies
220 Views
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
Posted
by golandsh.
Last updated
.
Post not yet marked as solved
0 Replies
206 Views
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?
Posted
by johnherdz.
Last updated
.
Post not yet marked as solved
0 Replies
340 Views
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
Posted
by MobileTen.
Last updated
.
Post not yet marked as solved
1 Replies
352 Views
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.
Posted Last updated
.
Post not yet marked as solved
1 Replies
285 Views
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
Posted Last updated
.
Post not yet marked as solved
2 Replies
407 Views
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?
Posted Last updated
.
Post not yet marked as solved
1 Replies
288 Views
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)
Posted
by rex61.
Last updated
.
Post not yet marked as solved
1 Replies
297 Views
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?
Posted
by Cotin.
Last updated
.
Post not yet marked as solved
0 Replies
422 Views
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?
Posted Last updated
.
Post marked as solved
1 Replies
487 Views
I have a multipart message and in the MEMessageSecurityHandler.decodedMessage(forMessageData:) function call, I can access all of the headers of the email, but when I get to the body section, the actual content of the email is missing. I've dumped the data out to a file and can see that there is an X-Apple-Content-Length header been added, but the content of the multipart email --=-=W2HxPVXDSaWZZw=-= X-Apple-Content-Length: 11 Content-Type: application/pgp-encrypted --=-=W2HxPVXDSaWZZw=-= Content-Transfer-Encoding: 7Bit Content-Disposition: inline; filename=openpgp-encrypted-message.asc Content-Type: application/octet-stream; name="openpgp-encrypted-message.asc" X-Apple-Content-Length: 9608 --=-=W2HxPVXDSaWZZw=-=-- How can I access the content of these parts to decrypt the message?
Posted Last updated
.