I want to know if it’s possible to send email through iPhone simulator. I have seen the
tutorial for sending an email through iphone as below:
http://www.edumobile.org/iphone/iphone-programming-tutorials/compose-mail-application-in-iphone/
Now to test it is it necessary to have real device? What is the way if I want to send email
through iPhone simulator?
You have to rely on the iOS that the
MFMailComposeResultthat is handed back inmailComposeController:didFinishWithResult:error:is correct. The simulator fakes that result; no actual mail is sent although it saysMFMailComposeResultSent.The tutorial mentioned misses an important point: The first thing you should do before using
MFMailComposeViewControlleris to check[MFMailComposeViewController canSendMail]. That will returnNO, if the user hasn’t configured mail on their device. If you must support an iOS version prior to 3.0 the correct way is to check if the classMFMailComposeViewControllerexists:The canSendMail-issue can only be tested on a real device though. It will crash if you don’t check canSendMail and the user has no mail account configured.