How Do I Access Email Messages?

Discussion in 'iOS Programming' started by ArtOfWarfare, Jun 19, 2013.

  1. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #1
    I have ideas for an iOS email client that mostly focuses around having your content automagically organized for you. I know how to send emails from iOS via the Message UI Framework, but I don't know how to access email messages.

    How do I:
    1 - Access email accounts the user has configured on the device*?
    2 - Download email messages that the user has sent?
    3 - Download email messages that the user has received?

    * Not a deal breaker if I can't, but it'd be really nice if my client had no set up necessary for any accounts the user already set up for the built in mail application.
     
  2. Guiyon macrumors 6502a

    Joined:
    Mar 19, 2008
    Location:
    North Shore, MA
    #2
    Due to the sandbox, your options are pretty limited here. You'll need to implement your own mail stack (or find one with an appropriate license). The first that comes to mind is MailCore

    To summarize:
    1: You don't. You can send an email, that's about it
    2 & 3: Build an IMAP/POP/SMTP client
     
  3. ArtOfWarfare thread starter macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #3
    MailCore looks like an immensely useful framework, thanks for sharing!

    Can I at least fetch a list of email accounts the user has configured on iOS, so I can prompt them for the necessary information for accounts I know they have?
     
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    I don't believe you can.
     
  5. ArtOfWarfare thread starter macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #5
    Hmm... Alright. I'm planning on making the app for both OS X and iOS so maybe I'll make the OS X app grab that kind of information and sync it with iOS... Or maybe I'll just make a companion utility that I host on Dropbox and have people download that and all it does is take the info and send it to the iOS version.

    I guess it's not the biggest concern right now.

    Maybe I should learn how the other mail apps work...
     
  6. Guiyon macrumors 6502a

    Joined:
    Mar 19, 2008
    Location:
    North Shore, MA
    #6
    If you are going to have it on the App Store you may run into issues there as well; I'm not sure how limited access to the Keychain is when running in the sandbox.
     
  7. truehybridx macrumors member

    Joined:
    Dec 6, 2010
    #7
    Doesn't that run into privacy concerns?

    And with all the privacy drama going on would be a bad idea :/
     
  8. ArtOfWarfare thread starter macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #8
    On OS X Apple allows apps that poke holes in the sandbox if you clearly disclose that you are doing so and explain why. The free utility would be distributed through a public folder in Dropbox (easiest way I've found for distributing free OS X apps) and doesn't need to limit itself to the sandbox at all.
     
  9. ArtOfWarfare, Jun 23, 2013
    Last edited by a moderator: Jun 23, 2013

    ArtOfWarfare thread starter macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #9
    I would like to point out that there actually appears to be a newer version of MailCore, MailCore 2, which supports IMAP, SMTP, and POP (whereas the original version only supports IMAP and SMTP as far as I can tell.)

    The process for including it also appears to have been simplified.

    Here's a link to MailCore2's repo:
    https://github.com/MailCore/mailcore2
    (Notice that both appear to be hosted on the same account.)

    Here's a YouTube video showing how to set it up:
     
  10. ahan.tm macrumors regular

    Joined:
    Jun 26, 2011
    Location:
    Florida
    #10
    I read about "shared keychain items" in the Apple Developer Docs, however there is no information on wether this is just for downloaded apps or for System apps.
     

Share This Page