Search code examples
cocoa-touchiphone-sdk-3.0mfmailcomposeviewcontroller

How can I send email from my application?


I want to attach a video and send email from my application.
I downloaded apples example code MailComposer. I compiled it. I did not get any errors or warnings.
I sent the mail to my mail id. But, I could not see any mail in my inbox. I am working on simulator.
I did not set any senders email id in simulator. How can I know whether the code is working or not ?
Thank You.


Solution

  • The simulator cannot send email; nor can all devices, as you'll discover if you use the MFMailComposeViewController +canSendMail method—it returns NO if the device doesn't have a mail account set up. To quote the documentation:

    You should call this method before attempting to display the mail composition interface. If it returns NO, you must not display the mail composition interface.