Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/grails/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 电子邮件问题:希望在没有其他窗口的情况下发送电子邮件_Iphone_Email_Sendmail_Mfmailcomposeviewcontroller_Mfmailcomposer - Fatal编程技术网

Iphone 电子邮件问题:希望在没有其他窗口的情况下发送电子邮件

Iphone 电子邮件问题:希望在没有其他窗口的情况下发送电子邮件,iphone,email,sendmail,mfmailcomposeviewcontroller,mfmailcomposer,Iphone,Email,Sendmail,Mfmailcomposeviewcontroller,Mfmailcomposer,我想在不显示MFMailComposeViewController的情况下发送电子邮件。我只想发送电子邮件到一些电子邮件序列(所以用户应该只看到我的微调器,而不是带有发送按钮的MFMailComposeViewController) 我知道发送电子邮件的唯一方法是:(但这不是我想要的) 如果没有MFMailComposeViewController的附加屏幕,如何发送电子邮件 提前谢谢你 您可以使用从设备传递的To、Message、Subject创建和调用php服务调用,您可以使用从设备传递的T

我想在不显示MFMailComposeViewController的情况下发送电子邮件。我只想发送电子邮件到一些电子邮件序列(所以用户应该只看到我的微调器,而不是带有发送按钮的MFMailComposeViewController)

我知道发送电子邮件的唯一方法是:(但这不是我想要的)

如果没有MFMailComposeViewController的附加屏幕,如何发送电子邮件


提前谢谢你

您可以使用从设备传递的To、Message、Subject创建和调用php服务调用,

您可以使用从设备传递的To、Message、Subject创建和调用php服务调用,

您可以通过Web服务来完成。编写一个web服务,该服务将邮件正文和收件人的电子邮件地址、主题等作为参数,并从后端发送邮件。

您可以通过web服务来完成。编写一个web服务,该服务为电子邮件正文和收件人的电子邮件地址接收消息,主题等作为参数,并从后端发送邮件。

苹果公司没有提供API,可以让您在没有用户交互的情况下发送电子邮件。

苹果公司没有提供API,可以让您在没有用户交互的情况下发送电子邮件。

我认为没有这一点是不可能的。我认为没有这一点是不可能的。
-(void)showMessageController:(id)sender
{

    Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
    if (mailClass != nil)
    {
        // We must always check whether the current device is configured for sending emails
        if ([mailClass canSendMail])
        {
            [self displayComposerSheet];
        }
        else
        {
            [self launchMailAppOnDevice];
        }
    }
    else
    {
        [self launchMailAppOnDevice];
    }
}

// Displays an email composition interface inside the application. Populates all the Mail fields. 
-(void)displayComposerSheet 
{
    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    [appDelegate setNavigationBarTextured:YES navigationBar:picker.navigationBar];
    picker.mailComposeDelegate = self;

    [picker setSubject:@"Please, look at my photo!"];

    // Attach an image to the email (mydata - data of the image)
    [picker addAttachmentData:myData mimeType:@"image/png" fileName:@"photo"];

    // Fill out the email body text
    NSString *emailBody = @"Hello!\nPlease, have a look at my photo!";
    [picker setMessageBody:emailBody isHTML:NO];

    [self presentModalViewController:picker animated:YES];
    [picker release];
}




// Launches the Mail application on the device.
-(void)launchMailAppOnDevice
{
//  NSString *recipients = @"mailto:first@example.com?cc=second@example.com,third@example.com&subject=Hello from California!";
    NSString *recipients = @"mailto:subject=Please, look at my photo!";

    NSString *body = @"&body=Hello!\nPlease, have a look at my photo!";

    NSString *email = [NSString stringWithFormat:@"%@%@", recipients, body];
    email = [email stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:email]];
}