Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.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_Html_Ios_Email - Fatal编程技术网

如何通过在iPhone应用程序中编程在电子邮件中添加附件和签名/

如何通过在iPhone应用程序中编程在电子邮件中添加附件和签名/,iphone,html,ios,email,Iphone,Html,Ios,Email,如何在iPhone应用程序iPhone中的电子邮件中以编程方式添加视频/图像/音频作为附件,以及如何添加签名?我认为这可以通过使用html标签来实现,但是如何实现呢。你能为这个提供一些示例代码吗。 感谢-发送附件:您可以使用MFMailComposeViewController从应用程序发送附件 1.添加MessageUI框架,并执行#导入 2.在您的电子邮件按钮操作中或以何种方式发送电子邮件时,添加: if([MFMailComposeViewController canSendMail])

如何在iPhone应用程序iPhone中的电子邮件中以编程方式添加视频/图像/音频作为附件,以及如何添加签名?我认为这可以通过使用html标签来实现,但是如何实现呢。你能为这个提供一些示例代码吗。
感谢-

发送附件:您可以使用
MFMailComposeViewController
从应用程序发送附件

1.添加
MessageUI
框架,并执行
#导入

2.在您的电子邮件按钮操作中或以何种方式发送电子邮件时,添加:

if([MFMailComposeViewController canSendMail]) //IMPORTANT: check if mail can be sent to avoid crash
{
    MFMailComposeViewController*mailController=[[MFMailComposeViewController alloc] init];

    NSURL*yourUrl=[NSURL fileURLWithPath:yourFilePath];
    NSData*attachData=[NSData dataWithContentsOfURL:yourUrl];

    mailController.mailComposeDelegate=self;
    [mailController addAttachmentData:attachData mimeType:@"yourExtension" fileName:@"yourFileName.yourExtension"];
    [mailController setSubject:@"Test Subject"];
    [mailController setTitle:@"Test Title"];


    if(mailController!=nil)
    {
        [self presentModalViewController:mailController animated:YES];
    }

    [mailController release];
}

else //give a prompt showing no mail accounts found
{
    UIAlertView*emailAlert=[[UIAlertView alloc] initWithTitle:@"No Email Account Found." message:@"Please set an email account." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
    [emailAlert show];
    [emailAlert release];
}
设置签名:我猜它使用与已设置的邮件帐户相关的签名。抱歉,不知道如何以编程方式更改它

看这里: