O'Reilly logo

Beginning iOS 5 Application Development by Wei-Meng Lee

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

SENDING E-MAIL

Sending e-mail is one of the many tasks performed by iPhone users. Sending e-mail onthe iPhone is accomplished using the built-in Mail application, which is a rich HTML mail client that supports POP3, IMAP, and Exchange e-mail systems, and most web-based e-mail such as Yahoo! and Gmail.

There are times where you need to allow your user to send an e-mail message in your iPhone application. A good example is embedding a feedback button in your application that users canclick to send feedback to you directly. You have two ways to send e-mail programmatically:

  • Build your own e-mail client and implement all the necessary protocols necessary to communicate with an e-mail server.
  • Invoke the built-in Mail application and ask it to send the e-mail for you.

Unless you are well versed in network communications and familiar with all the e-mail protocols, your most logical choice is the second option — invoke the Mail application to do the job. The following Try It Out shows you how.

TRY IT OUT: Sending E-Mail Using the Mail Application

image

  1. Using Xcode, create a Single View Application (iPhone) project and name it Emails. You need to also use the project name as the Class Prefix and ensure that you have the Use Automatic ReferenceCounting option unchecked.
  2. Select the EmailsViewController.xib file to edit it in Interface Builder. Populate the View window with the following views(see ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required