ios - 应用内电子邮件发出嗖嗖声但不发送

标签 ios objective-c email mfmailcomposeviewcontroller

我可以正常进入 Mail 程序,当我按下“发送”时,我听到嗖嗖声,Mail 关闭并返回到我的应用程序,但实际邮件没有发送。

这是我用来发送邮件的代码。关于我做错了什么的想法?

(我在实际设备上使用 iOS6,而不是模拟器。)

-(void)openMail {

            //Open Mail program and create email with haiku attached as image.

if ([MFMailComposeViewController canSendMail])
{
    MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
    mailer.mailComposeDelegate = self;
    [mailer setSubject:[NSString stringWithFormat:@"subject"]];
    UIImage *myImage = [self createImage];
    NSData *imageData = UIImagePNGRepresentation(myImage);
    [mailer addAttachmentData:imageData mimeType:@"image/jpg" fileName:@"xxxxx"];
    NSString *emailBody = @"I thought you might like this haiku from the xxxxx iPhone app.";
    [mailer setMessageBody:emailBody isHTML:NO];
    [self presentViewController:mailer animated:YES completion:NULL];
}

            //Unless it's not possible to do so, in which case show an alert message.

else
{
    self.alert = [[UIAlertView alloc] initWithTitle:@"I'm sorry." message:@"Your device doesn't seem to be able to email this haiku. Perhaps you'd like to tweet it or post it on Facebook instead?" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
    [self.alert show];
}
}

-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
[self dismissViewControllerAnimated:YES completion:Nil];
}

最佳答案

看起来这实际上是我的服务器和 iOS 6.1 更新之间的问题。如果其他人遇到同样的问题,我会保留它。如果问题已解决,但我的电子邮件仍然无法发送,那么我会发布另一个问题。

关于ios - 应用内电子邮件发出嗖嗖声但不发送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14570085/

相关文章:

ios - MergeSwiftModule - 在 Xcode 6.3 中构建 Swift 应用程序卡在 "Merge MyApp.swiftmodule"

iphone - AFNetworking AFMultipartFormData如何设置key

ios - 如何在 iOS 中下载带有图像、CSS 等内部资源的网页?

ios - 是否可以自定义触发 UIScrollView 滚动的滑动手势识别?

iphone - 是否可以通过 TCP 连接到在 3G 网络端口上监听的 iPhone?

iphone - AudioUnitInitialize 在初始化 AudioComponentInstance 时抛出错误

ios - AppDelegate 中的点击覆盖代码不起作用。如何修复这些错误?

email - 跟踪电子邮件退回、打开、点击

email - 如何从 Go 发送电子邮件

PHPmailer 重复电子邮件问题 - 带 $mail->Send() 的条件语句