Javascript Mandrill未发送附件和图像

Javascript Mandrill未发送附件和图像,javascript,jquery,base64,email-attachments,mandrill,Javascript,Jquery,Base64,Email Attachments,Mandrill,我在JS代码中使用Mandrill API发送消息,包括base64编码的背景图像 HTML: 我做错了什么 UPD:问题解决了。图像和附件数组必须位于消息数组中 .......... <div id="image" style="background-image: url("data:image/png;base64,wFEFefFEFW........");"> .......... var image_1 = $('#image').css('background-i

我在JS代码中使用Mandrill API发送消息,包括base64编码的背景图像

HTML:

我做错了什么

UPD:问题解决了。图像和附件数组必须位于消息数组中

..........    
<div id="image" style="background-image: url("data:image/png;base64,wFEFefFEFW........");">
..........
var image_1 = $('#image').css('background-image'); //image base64 encoded
image_1 = image_1.replace('url("data:image/png;base64,','').replace('")','');
subject = 'text';
subject += '<img src="cid:image_1">';
event.preventDefault();
$.ajax({
    type: 'POST',
    url: 'https://mandrillapp.com/api/1.0/messages/send.json',
    data: {
        'key': '*******',
        'message': {
            ................
            'html': subject + '<br />'
        },
       'images' : [{
           'type' : 'image/png',
           'name' : 'image_1',
           'content' : image_1
       }]
.....................
'attachments' : [{
    'type' : 'image/png',
    'name' : 'image_1',
    'content' : image_1
}]