MFMailComposeViewController is implemented but I still can't receive the mail
I'm excercising a sample code in "More iphone 3 Development Tackling iphone SDK 3" which called MailPic. Everything is fine. No error no warning.
- (IBAction)selectAndMailPic {
UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera;
if (![UIImagePi开发者_如何学PythonckerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypeCamera]) {
sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}
UIImagePickerController *picker =
[[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = sourceType;
[self presentModalViewController:picker animated:YES];
[picker release];
}
- (void)mailImage:(UIImage *)image {
if ([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc] init];
mailComposer.mailComposeDelegate = self;
[mailComposer setSubject:NSLocalizedString(@"Here's a picture...", @"Here's a picture...")];
[mailComposer addAttachmentData:UIImagePNGRepresentation(image) mimeType:@"image/png" fileName:@"image"];
[mailComposer setMessageBody:NSLocalizedString(@"Here's a picture that I took with my iPhone.", @"Here's a picture that I took with my iPhone.") isHTML:NO];
[self presentModalViewController:mailComposer animated:YES];
[mailComposer release];
[image release];
}
else
message.text = NSLocalizedString(@"Can't send e-mail...", @"Can't send e-mail...");
}
sending mail is good but I still can't receive it. What did I miss? sending mail is good but I still can't receive it. What did I miss?
MFMailComposeViewController doesn't actually sends the mail. It just queues the mail in the Mail app's Outbox, nothing more. You check the Mail app's Outbox and see whether the mail is actually sent or not.
There may be some problem with the internet connectivity in your phone. In the worst case, resending the mail from Mail app's Outbox may help you!
MFMailComposer is only for sending mails not for receiving mails. You need to read class reference of MFMailComposer.
This app is work on iphone or real time device not on simulator.
精彩评论