iphone中的html附件

时间:2009-08-03 10:33:29

标签: iphone

我在电子邮件中附加图片。但是如何在电子邮件中附加html文件? 这是我在电子邮件中附加图像文件的代码。

UIImage *artworkImage = viewImage;
NSData *artworkJPEGRepresentation = nil;
if (artworkImage) 
{
    artworkJPEGRepresentation = UIImageJPEGRepresentation(artworkImage, 0.7);
}
if (artworkJPEGRepresentation)
{
    [composeVC addAttachmentData:artworkJPEGRepresentation mimeType:@"image/jpeg" fileName:@"Image.jpg"];
}
[self presentModalViewController:composeVC animated:YES];
[composeVC release];

我们如何以相同的方式附加HTML。

我不想将HTML设置为正文,我想将HTML作为附件发送。

请指导我这个问题。

1 个答案:

答案 0 :(得分:0)

您是否尝试过以与处理图片相同的方式添加它:

NSData* htmlAttach = [NSData dataWithContentsOfFile:@"html-file.html"];
[composeVC addAttachmentData:htmlAttach
                    mimeType:@"text/html"
                    fileName:@"html-file.html"
];