Is it possible to retrieve the user email associated with the default email account directly from an app?
Screenshot:
Thanks.
The first email you add to the iPhone Mail app becomes your default. This means that when you compose a new email or click on an email address on a website or app, it opens with this default email in the 'From' section.
Your default email account is simply your primary email account. The email will appear when you tap the “compose” email icon.
I can't prove a negative, but I am fairly certain this is not possible. You can use MFMailComposeViewController to allow the user to send an email from the default account, but you cannot directly access information about the default account. If you need the user's email address, you either have to ask for them to type it in, or have them select it from their contacts.
In addition to @woz answer, this is a gist that can help you.
In my app, I have a feedback form to let users could get in touch with me. Unfortunately, many users had minor misspellings in their email addresses and I couldn't reach back to them.
As I couldn't get a perfect way to be sure the email was correct, I've developed the following gist which:
Again, this is far from perfect and I only included this behavior optionally (a little 'check mail' button next to the UITextField)
https://gist.github.com/dirtyhenry/7547064
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With