0

inline image attachment

I'm trying to include an inline image attachment in my message but I'm getting a SendMessageFailed error with "Unknown part type 5".

Do I have to upload the inline attachment via the UploadAttachment method even though I'm only going to reference it inline?
Or is my MIME structure incorrect? I couldn't find any kind of docs on what multipart types are accepted by the API.

The MIME structure has been tested to work when similarly generated with the python mail modules; included below is a snipped version of my message part structure.

CODE
{
"subparts": [
{
"type": "text",
"encoding": "7bit",
"data": "/// plain text message data ///",
"charset": "utf-8",
"subtype": "plain"
},
{
"subparts": [
{
"type": "text",
"encoding": "7bit",
"data": "/// <html> message data </html> ///",
"charset": "utf-8",
"subtype": "html"
},
{
"subtype": "png",
"contendid": "<thumbnail>",
"disposition": "inline",
"encoding": "base64",
"type": "image",
"charset": "utf-8",
"data": "/// base64 encoded image ///",
"filename": "thumbnail.png"
}
],
"subtype": "related",
"charset": "utf-8",
"type": "multipart"
}
],
"subtype": "alternative",
"charset": "utf-8",
"type": "multipart"
}


The https://github.com/ramiyer/YahooMailApiSample has been really helpful with examples, but doesn't include a way to handle inline images.

by
  • bw
  • Feb 10, 2011
1 Reply
  • Yes. Please refer ComposeMessagePart.


    QUOTE (b @ Feb 10 2011, 05:33 PM) <{POST_SNAPBACK}>
    I'm trying to include an inline image attachment in my message but I'm getting a SendMessageFailed error with "Unknown part type 5".

    Do I have to upload the inline attachment via the UploadAttachment method even though I'm only going to reference it inline?
    Or is my MIME structure incorrect? I couldn't find any kind of docs on what multipart types are accepted by the API.

    The MIME structure has been tested to work when similarly generated with the python mail modules; included below is a snipped version of my message part structure.

    CODE
    {
    "subparts": [
    {
    "type": "text",
    "encoding": "7bit",
    "data": "/// plain text message data ///",
    "charset": "utf-8",
    "subtype": "plain"
    },
    {
    "subparts": [
    {
    "type": "text",
    "encoding": "7bit",
    "data": "/// <html> message data </html> ///",
    "charset": "utf-8",
    "subtype": "html"
    },
    {
    "subtype": "png",
    "contendid": "<thumbnail>",
    "disposition": "inline",
    "encoding": "base64",
    "type": "image",
    "charset": "utf-8",
    "data": "/// base64 encoded image ///",
    "filename": "thumbnail.png"
    }
    ],
    "subtype": "related",
    "charset": "utf-8",
    "type": "multipart"
    }
    ],
    "subtype": "alternative",
    "charset": "utf-8",
    "type": "multipart"
    }


    The https://github.com/ramiyer/YahooMailApiSample has been really helpful with examples, but doesn't include a way to handle inline images.
    0

Recent Posts

in Yahoo! Mail Web Services API