【问题标题】:html attachement in iphoneiphone中的html附件
【发布时间】:2023-03-25 01:34:01
【问题描述】:

我在电子邮件中附加图像。但是我们如何在电子邮件中附加 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 作为附件发送。

请就这个问题指导我。

【问题讨论】:

    标签: iphone


    【解决方案1】:

    您是否尝试过以与图像相同的方式附加它:

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

    【讨论】:

    • 是的,我已经尝试过了,但它不起作用,它在电子邮件中附加了 html 文件,但不处理该 html。我的意思是它没有显示我在 html 中所做的事情,比如显示一些消息.
    • 你能澄清你的问题吗 - 你没有说你希望 HTML 如何显示。作为身体?作为正文中的文件图标?别的东西 - 如果是这样呢?
    猜你喜欢
    • 2010-10-27
    • 1970-01-01
    • 1970-01-01
    • 2010-11-26
    • 2011-01-16
    • 1970-01-01
    • 2012-07-14
    • 2016-05-03
    • 1970-01-01
    相关资源
    最近更新 更多