在iOS中使用Mandrill API的电子邮件图像附件无法正常工作 [英] Image attachment is not working properly with email using Mandrill API in iOS

查看:115
本文介绍了在iOS中使用Mandrill API的电子邮件图像附件无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Mandrill API 发送电子邮件.一切正常,即使图像附件也正常工作.但是图像的问题在于,电子邮件在主题行中没有附件签名,并且附件图像也没有名称.问题与名称键有关,这是JSON的图像附件部分.我尝试了多种方法来命名,但没有一种方法适合我.

I am using Mandrill API to send email. Everything is working fine even image attachment is working good. But the problem with image is that email don't have attachment sign in subject line and also attached image don't have a name. The problem is with name key here is image attachment part of JSON. I tried many ways to give name but none of them works for me.

images:[
        {
            "type": "image/png",
            "name": "IMAGECID",
            "content": "ZXhhbXBsZSBmaWxl"
        }
    ]

推荐答案

附件图标将特定于您正在使用的电子邮件程序.但是,通常,如果要添加某些内容作为附件,则应使用attachments数组而不是images数组. images数组用于将嵌入式图像嵌入HTML内容中,而不仅仅是将图像添加为附件.使用images数组时,还需要在HTML中包含图像标识符.因此,在与示例中包含的图片相同的情况下,您的HTML内容需要包含以下内容:

The attachment icon is going to be somewhat specific to the email program you're using. However, in general, if you want something added as an attachment, you should use the attachments array instead of the images array. The images array is for embedding inline images in your HTML content, not simply adding images as attachments. When you use the images array, you need to also include the image identifier in your HTML. So int he case of the same image you've included in the example, your HTML content would need to include this:

<img src="cid:IMAGECID">

在以下文档中记录了消息/发送API端点的images数组: https://mandrillapp.com/api/docs/messages.JSON.html#method=send

This is documented for the images array for the messages/send API endpoint here: https://mandrillapp.com/api/docs/messages.JSON.html#method=send

如果您使用的是Gmail,并且需要附件图标,则将图像放在attachments数组中.它们不会在您的内容中内嵌,但将作为附件添加.

If you're using Gmail, and want the attachment icon, then put your images in the attachments array instead. They won't render inline in your content, but will be added as attachments.

这篇关于在iOS中使用Mandrill API的电子邮件图像附件无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆