0
我正在使用MessageUI框架发送电子邮件,但发送时我从未收到该电子邮件。未收到使用MessageUI框架发送的电子邮件
我进口#import <MessageUI/MessageUI.h>
,然后我有以下代码
- (void)emailFile
{
if(![MFMailComposeViewController canSendMail]) {
UIAlertView *cantSend = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Device not configured to send email" delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[cantSend show];
[cantSend release];
} else {
MFMailComposeViewController *mailView = [[[MFMailComposeViewController alloc] init] autorelease];
mailView.mailComposeDelegate = self;
[mailView setToRecipients:[NSArray arrayWithObject:@"[email protected]"]];
[mailView setSubject:@"Test"];
[mailView setMessageBody:@"This is a text message" isHTML:NO];
[self presentModalViewController:mailView animated:YES];
}
}
和
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
if(error) {
UIAlertView *errorView = [[UIAlertView alloc] initWithTitle:@"Mail Error" message:[error localizedDescription] delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[errorView show];
[errorView release];
} else {
switch (result) {
case MFMailComposeResultSent:
NSLog(@"Sent Mail");
break;
case MFMailComposeResultSaved:
NSLog(@"Mail Saved");
break;
case MFMailComposeResultCancelled:
NSLog(@"Mail Cancelled");
break;
case MFMailComposeResultFailed:
NSLog(@"Mail Failed");
break;
default:
break;
}
}
[controller dismissModalViewControllerAnimated:YES];
}
我在控制台中“已发送邮件”的消息,但我想我说我从未收到我发送的电子邮件。
我已经通过了苹果的文档不见了,找不到任何有助于任何人都可以帮我请。我是我做错了什么?
您是否检查过您正在使用的电子邮件的发件箱? – 2012-01-05 10:49:29