views:

538

answers:

2

I am tring to send an email using xcode on Mac PC. For this I am using MFMailComposeViewController class and I have attached the code files:

But when I click on send button of the modal view controller then it returns MFMailComposeResultSent object of MFMailComposeResult class but the email did not reach to the specified email id. When I click on Cancel button then it returns MFMailComposeResultCancelled.

And I have also configured my mac with an email account. But the thing which I am not able to understand is How this email account is connected with the above code because even if when I delete all the email accounts from the mac machine then also on clicking the send button of the modalViewController it returns the MFMailComposeResultSent object.

Can someone help me in sending the email and understanding the communication between the email accounts and the above code.

Thanks in advance.

+7  A: 

Are you doing this in the simulator, or on an actual device. MFMailComposeViewController doesn't actually send mail from the simulator.

Ben Gottlieb
+1, it does look like he's using the simulator.
Graham Lee
+1  A: 

Thanks Ben,

I was testing it on simulator only because I was not aware of the fact that MFMailComposeViewController does not support sending emails using simulator.

once again thanks for your support.

Gaurav Arora