Let the user choose an e-mail client on iOS - ios

We would like to give the ability to the user to choose any installed email client (Gmail, Yandex, etc.) in our app. But iOS provides only Mail or builtin MFMailComposeViewController. Is there any way to present a list of email clients to the user?

There's no way to achieve this directly, as iOS doesn't know the concept of 'default application'. You could implement yourself a function which checks the various URLs used by different iOS email clients, and determines which clients are installed. For instance, GMail uses googlegmail://. You could also show a menu with the clients found on the device.
If you don't want to create your own implementation, ThirdPartyMailer is a library that can do this for you.

If you're looking for something similar to the way Android handles it, then no it's not possible. Some email apps though might support a custom scheme - for example Gmail uses googlegmail:// (taken from this question).

You should try something like this:
let url = NSURL(string: "mailto:jon.doe#mail.com")
UIApplication.sharedApplication().openURL(url)

Related

How to make a WhatsApp call from app - Swift

I want to make a WhatsApp call to a contact from my app, I already searched a lot, and did not find any answer, seems like it's restricted to OS only, but these questions are a little outdated
eg: Url scheme for making WhatsApp call programmatically from iOS app (voice call VOIP)?
and: How can I place a WhatsApp call from an iOS app?
also in WhatsApp docs: https://faq.whatsapp.com/iphone/how-to-link-to-whatsapp-from-a-different-app
I am trying to find if it's possible in 2021 or not yet
Thank you
The first thing to consider here is that "calling through WhatsApp" is a feature of the WhatsApp itself and doesn't have any relation with features of the operating system.
So you need to understand that trying to make the call is actually an integration between your app and WhatsApp. You need to send a "message" to WhatsApp saying that you want it to make a call to the specified number. But how this is done? The mechanism in iOS this kind of inter app integration the use of URL Schemes.
On your app side, the way to this is already answered in one of your links:
if #available(iOS 10.0, *) {
UIApplication.shared.open(NSURL(string: "whatsapp://send?phone=+91phonenumber")! as URL)
} else {
UIApplication.shared.openURL(NSURL(string: "whatsapp://send?phone=+91phonenumber")! as URL)
}
This is the right API. The thing is, it's up to the app maker (in this case WhatsApp) to decide which features it makes available to other apps to be requested, via a custom URL. Now one of the references that you sent is the official WhatsApp docs. There are examples of URL's that you need to call to integrate with WhatsApp, but I couldn't find anything related to start a call.
Probably WhatsApp developers haven't added a specific interface to allow this kind of integration, but it may be undocumented because you can do this from Siri Shortcuts, and it uses mostly the URL Scheme mechanism. Here's a reference that might be helpful to try to find the available schemes.

Possible to open mail app with search results displayed from app?

I don't want to write my own email app. All I want is to be able redirect to mail with a preconfigured search string to display relevant emails. There doesn't appear to be a way to read or list emails from mail.app from within another app. Am I overlooking something? Is there a workaround for this?
I am fully aware of and able to use message UI in my app. What I want is to read, not send, email that has already been downloaded and exists in mail.app.
The only way that you can use to connect apps with other apps in iOS is thought url scheme.
You can take a look at Url Scheme reference
but it seems like you can't make this action.
UPDATE:
you can take a look the extra functionalities at Wikipedia

How to modify iOS Mail app?

I'd like to add functionality to the existing iOS Mail app, specifically - the ability to hide emails for later review (e.g. 'snooze' functionality). I know this functionality existing is multiple 3rd party mail apps like Mailboxapp etc but all of these 3rd party mail apps for iOS only work with Gmail and I want to use this 'snooze email' functionality for non-Gmail accounts.
As such, I can't find the Apple API to modify the mail app to add this 'snooze email' functionality.
How would I go about adding functionality to the existing iOS mail app?
This is an interesting question, but at first glance it seems simple. Remember the rule of thumb? You can't modify apps that aren't your own.
As such, I can't find the Apple API to modify the mail app to add this 'snooze email' functionality.
You can't find the Apple API because there is no such API.
You do have three other options:
File a radar. Perhaps Apple will add this in an OS update if you ask nicely. You do have to ask, though.
Jailbreak and roll it yourself. You'll have to figure out what API exist all by yourself, without any Apple documentation to hold your hand. Your best bet is to try running otool or class-dump on the iOS frameworks to see if there are private methods you can use to set the status of an email. Once you have that working, you can try to figure out how and where you want to build out the user interface or gesture to "snooze" an email. It goes without saying that you can't distribute OS plugins on the App Store. If you want to distribute this, write your own email client and include a snooze feature.
File an enhancement request with other companies, such as Sparrow, Mailbox, and Google, and ask them to add this to their own apps. As you note in your question, Mailbox includes this already. You can try Sparrow and see if it supports snoozing (I don't know if it does non-gmail accounts.) You can also request that they support other kinds of email accounts.
If you're just looking to remind yourself to reply to emails, you can also schedule reminders in the reminders app or via Siri.
Actually, I just flag emails. There's a flagged inbox in iOS 7.
Jailbreak and install tweaks.
Apple's extraordinarily tight-fisted with their APIs. Modifying the actual application is not easily doable. If you need to change functionality, consider other mail applications available on the App Store.

Possible to send automated email?

The iOS SDK class MFMailComposeViewController can be used to let the user compose an email message.
What I'd like to do, is for the iOS app to send an email in the background, with no user interaction. Is this at all possible/allowed in the iOS SDK?
Nope. There isn't any API available to do this. You'd need to roll your own SMTP client and have the user enter credentials into your application. On top of that Apple may not approve this.
Unfortunately, I don't think Apple would ever allow this because (for example) then you could just get everyone's email address by auto-sending mail to yourself. :(
I actually wanted to implement something like this for the express purpose of alerting me when a critical error happens on an app in the app market.
Best solution would be to create an API (just ping a php file or something), and have it send the relative alert message to your email).

Is there a way to force an email received by a blackberry to open directly in a certain URL?

Let me explain:
There are some apps (like the Facebook app) that send emails to the BB device, but when I open the said email, it opens directly in my facebook app. How is that possible? Is there an API or something I need to know about to be able to program that on my own app?
On another topic, could I do the same thing, but simply force the email to open a certain url in the BB browser?
Hope I explained myself.
Cheers!
Short answer, yes.
Take a look at the Message List Demo Sample application and the net.rim.blackberry.api.messagelist.* apis. That will handle the "injecting my own stuff into the message list" component of what Facebook does.
Secondly as for "grabbing incoming emails and doing things with them" you need to use FolderListener from net.rim.blackberry.api.mail.* APIs

Resources