Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

access default email address

Tags:

iphone

I am using the MFMailComposeViewController in 3.0 to send an email with attachment etc. inside my app. I would like the "To:" address to be defaulted to the default account/address on the device. How can I access this address to place it into a string for the setToRecipients?

Essentially, I'm going to let the user send an email to themselves (as the default "To") with an attachment inside the app.

like image 749
driveguy Avatar asked Aug 04 '09 03:08

driveguy


People also ask

What is default email address?

Your default email account is simply your primary email account. The email will appear when you tap the “compose” email icon.

How do I get access to my email address?

Open the email app on your phone. Select your email provider from those listed (Gmail, Yahoo, Hotmail/Outlook, etc) or the “Other” option. Email services from website hosts or businesses will generally be “Other.” Enter your email account information as directed on the screen.

Where is the default email setting?

In Settings, click “Apps.” In Apps, click “Default Apps” in the sidebar. In the Default Apps section, click the icon located just below “Email.” This will allow you to select a new email client that you'd like to use as default.


3 Answers

The API doesn't expose that information publicly (for probably good reasons, such as preventing developers from harvesting iPhone users' email addresses).

You should probably go about asking for the user's email address and then saving it for future use.

like image 127
Neil Avatar answered Nov 10 '22 07:11

Neil


It appears that the accepted answer is wrong

Getting user's default email address in Cocoa

This answer shows the code for getting the e-mail address from the address book ( listed under 'me' )

EDIT: Note the comment! OSX only not iOS :|

like image 44
P i Avatar answered Nov 10 '22 06:11

P i


You can use ABGetMe for iOS to get the user's address book card. Have a look at the source code, you will see how to retrieve all e-mail addresses for a given ABRecordRef.

like image 25
0xced Avatar answered Nov 10 '22 07:11

0xced