0

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:@"matthew.inman@cdl.co.uk"]];
    [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];
}

コンソールに「Sent Mail」というメッセージが表示されますが、送信したメールがまったく届かないと言いました。

私はアップルのドキュメントを調べましたが、他の誰かが私を助けてくれるのに役立つものは何も見つかりません. 私は何か間違ったことをしているのですか?

4

1 に答える 1

3

デバイスでテストしていることを確認してください。シミュレーターを介して電子メールが送信されることはありません。

于 2012-01-04T14:42:12.797 に答える