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