Categories About Us Contact Us Become a Member

How to fix E12506 Unsupported file type, please upload valid files

This is a Kaleyra Email API rejection meaning your attachment decoded correctly but the file type was not accepted. Unlike its sibling E12505, the payload shape is fine, so the fault is the file itself or how you labelled it. Jump to your situation below or work through the methods in order.

By Neeraj Singh ~12 min Updated Jul 2026 90% found this helpful
Error message
E12506  |  parameter: attachment  |  "Unsupported file type, please upload valid files"
Summary

E12506 comes from the Kaleyra Email API and reads Unsupported file type, please upload valid files. It is worth being precise about what it is not: it is not E12505. E12505 fires when the content value is neither base64 nor an absolute URL, so the payload is malformed. E12506 fires after that check passes, which means your encoding worked and the API could read the file, but it will not accept the type it found. For an .eml the practical fixes are to label it correctly with content_type set to message/rfc822 and a real .eml filename, and to confirm the file genuinely is a mail message rather than something renamed. One honest caveat: Kaleyra does not publish a list of accepted file types, so if a correctly labelled, valid .eml is still refused, the type is not enabled on your account and only Kaleyra support can confirm it. Zipping the file or passing an absolute URL are the usual ways around that.

What E12506 is telling you

Kaleyra returns its Email API errors as a JSON object with a code, a type, the offending parameter and a message. E12506 carries the message Unsupported file type, please upload valid files, and it points at the attachment.

{
  "error": {
    "code": "E12506",
    "type": "Invalid Input",
    "parameter": "attachment",
    "message": "Unsupported file type, please upload valid files"
  }
}

The most useful thing to know is where this sits in the order of checks. E12505 is the earlier gate: it asks whether content is base64 or an absolute URL at all. If you are seeing E12506 instead, you have already passed that gate. Your encoding is fine and the file arrived intact. The API then looked at what the file is and refused it, which is why re-encoding, re-uploading or shrinking the file changes nothing here.

Figure 1: two different layers, two different encoding rules

Layer 1 Your JSON request

  • You send the file to Kaleyra inside a JSON body.
  • base64 is required here, or an absolute URL. Sending it any other way returns E12505.
  • This is transport encoding for JSON. It is not a MIME header.

Layer 2 The email Kaleyra builds

  • Kaleyra decodes your file and assembles the actual MIME message.
  • Here RFC 2045 forbids base64 on composite types such as message/rfc822, which must use 7bit, 8bit or binary.
  • This layer is Kaleyra's job, not yours.

These two rules look like a contradiction and it trips people constantly: one layer demands base64, the other forbids it. They are not in conflict, because they apply to different things. You base64 the file so it survives the JSON request. Kaleyra decodes it and decides the Content-Transfer-Encoding when it builds the message. So do not try to hand-set MIME encoding to satisfy RFC 2045, and do not stop base64-encoding your API payload because of it.

Figure 2: labelling an .eml attachment
"content_type": "message/rfc822"Correct. This is the registered MIME type for an email message file.
"filename": "message.eml"Correct. A real .eml extension, matching the content type.
"content_type": "application/octet-stream"Generic binary. It tells the API nothing about the file, so it cannot confirm the type.
"content_type": "text/plain"An .eml is readable text, so this feels right and is wrong. It is a mail message, not a text file.
"content_type": ""Blank. The type is left for the API to guess.
"filename": "message.txt"Extension contradicts the content type, so the two disagree about what the file is.

Keep the content type and the filename telling the same story. A file labelled message/rfc822 called message.txt is self-contradictory, and that is enough for a type check to refuse it.

Common causes of E12506

content_type was left blank, so the API had to guess the type.
The file is labelled application/octet-stream or text/plain rather than message/rfc822.
The filename has no extension, or one that contradicts the content type.
The file is not actually a mail message, for example a .msg or a renamed text file.
The .eml is truncated or malformed, so a type check cannot recognise it.
The account does not have the message/rfc822 type enabled.
The file was fetched from a URL that returned an error page rather than the file.
Expert insight

“The first thing I check is which of the two codes came back, because people treat them as the same error and they are not. E12505 means I could not read your file. E12506 means I read it fine and I do not want it. Once you see it that way you stop re-encoding, which is what most people do for an hour. Label it properly, message/rfc822 with a .eml filename, and make sure the thing really is a mail message and not a .msg someone renamed. And if a clean, correctly labelled .eml still bounces, stop guessing. Kaleyra has never published which types are enabled, so that is a support question, and zipping it is the pragmatic way through in the meantime.”

How to fix it

Method 1

Confirm the code is E12506, not E12505

1Check the JSON response. "code": "E12506" means the file was readable but the type was refused.
2If it says E12505 instead, your content is not valid base64 or an absolute URL, which is a different problem with a different fix. See E12505: attachment content is invalid.
3Getting this right first saves the most time, because the two errors have almost nothing in common.
Method 2

Set content_type to message/rfc822

1message/rfc822 is the registered MIME type for an email message file, so it is what an .eml should carry:
"attachments": [
  {
    "content": "TWltZS1WZXJzaW9uOiAxLjANCg...",
    "content_type": "message/rfc822",
    "filename": "message.eml"
  }
]
2Do not use text/plain. An .eml is readable as text, which makes this a tempting and wrong choice, because the file is a structured mail message rather than plain text.
3Do not use application/octet-stream either. It says only that the file is bytes, which gives a type check nothing to work with.
Method 3

Use a filename that matches the type

1Set filename to something ending in .eml, such as message.eml.
2Make sure the extension agrees with content_type. A file declared message/rfc822 but named message.txt contradicts itself.
3Avoid a filename with no extension at all, which leaves the type ambiguous.
Method 4

Confirm the file really is an .eml

1Open the file and check the first lines are mail headers, such as MIME-Version:, From: or Received::
head -5 message.eml
file message.eml
2A .msg file renamed to .eml is not a mail message. Outlook's .msg is a different, proprietary format and will not be recognised.
3If the file came from a URL, download it yourself and confirm you get the message rather than a login page or a 404.
Method 5

Do not hand-set MIME encoding to satisfy RFC 2045

1RFC 2045 does forbid base64 on composite types such as message/rfc822, which must use 7bit, 8bit or binary. That rule is real, and it is often quoted at this error.
2It does not apply to your API request. The base64 in content is JSON transport encoding, not a MIME Content-Transfer-Encoding header. Kaleyra decodes it and builds the message, so that rule is theirs to honour.
3Practically: keep base64-encoding your payload, and do not add MIME encoding headers of your own. See Figure 1.
Method 6

If the type is simply not allowed

1Kaleyra does not publish a list of accepted attachment types, so a valid, correctly labelled .eml that is still refused points at the type not being enabled.
2Zip the .eml and send the archive instead, which changes the type to a common one.
3Or host the file and pass an absolute URL in content, which is a supported alternative to base64.
Method 7

Ask Kaleyra which types are enabled

1Because the allowed list is not documented, support is the only way to confirm whether message/rfc822 is permitted on your account.
2The email channel has to be enabled and your sending domain whitelisted anyway, so this is the same team.
3Quote the exact error and the content type you are sending.
Method 8

Test with a known-good file

1Send a small, plainly supported attachment such as a short .txt to prove the request shape works.
2If that succeeds and your .eml fails with E12506, the shape is fine and the type is the issue, which narrows it to labelling or account permissions.
3Then re-test the .eml with the content type and filename corrected.

Re-encoding will not fix this one. If the API returned E12506 rather than E12505, it already read your file successfully, so the base64 is fine and doing it again more carefully changes nothing. The question is no longer whether the file arrived, it is what the file is: how you labelled it, whether it really is a mail message and whether the type is enabled on your account.

Make sure it is really E12506

Kaleyra runs its attachment checks in order, and each failure returns a different code. Reading the code field tells you which check you failed and therefore what to change.

Figure 3: E12506 against the codes it gets confused with
E12506: Unsupported file type, please upload valid files
MeansThe file was read fine but its type is not accepted. ActionYou are on the right page.
E12505: Attachment content is invalid, only base64 or absolute URL is allowed
MeansThe content value is neither base64 nor an absolute URL. ActionDifferent error. Fix the encoding or pass a URL.
E14512: Attachment content exceeded limit
MeansThe attachment is too large. ActionDifferent error. Shrink the file or link to it.
E14514: Request payload exceeded
MeansThe whole request passed the 20 MB cap. ActionDifferent error. Reduce total payload.
E12500: Invalid input
MeansA generic validation failure somewhere in the request. ActionDifferent error. Read the parameter field.

Read the codes as a sequence rather than a list. E12505 asks can I read this. E12506 asks will I accept this. E145xx asks is this too big. Each one only fires once the previous check has passed, so the code tells you how far your request actually got.

Frequently asked questions

What does E12506 mean?
It is a Kaleyra Email API error reading: Unsupported file type, please upload valid files. Your attachment decoded successfully, but the API would not accept the type of file it found, so the request is rejected and nothing is sent.
What is the difference between E12505 and E12506?
E12505 means the content value was neither base64 nor an absolute URL, so the file could not be read at all. E12506 means the file was read successfully but its type is not accepted. If you have E12506, your encoding is already fine.
What content type should I use for an .eml?
message/rfc822, which is the registered MIME type for an email message file. Set it in content_type alongside a filename ending in .eml, so the type and the extension agree with each other.
Why does application/octet-stream not work?
It only says the file is binary data, which gives a type check nothing to identify. Label the file as message/rfc822 so the API knows it is a mail message rather than an unknown blob.
Can I base64-encode the .eml attachment?
Yes, and you must. RFC 2045 forbids base64 on composite types like message/rfc822, but that rule governs the MIME message Kaleyra builds, not your JSON request. The base64 in content is transport encoding for JSON, so keep using it.
Does the file extension matter?
Yes. Use a .eml extension that matches your content_type. A file declared message/rfc822 but named message.txt contradicts itself, and a filename with no extension leaves the type ambiguous.
Which file types does Kaleyra support?
Kaleyra does not publish a list of accepted attachment types. That is why a valid, correctly labelled .eml can still be refused, and why support is the only way to confirm whether message/rfc822 is enabled on your account.
What if message/rfc822 is not allowed on my account?
Zip the .eml and send the archive, which changes the type to a common one, or host the file and pass an absolute URL in content instead of base64. Both are supported ways to get the message through.
Could a .msg file cause E12506?
Yes. Outlook's .msg is a proprietary format, not a MIME mail message, so renaming it to .eml does not make it one. Export the message as a genuine .eml from the client before attaching it.
Would shrinking the file fix E12506?
No. Size limits return E14512 or E14514, not E12506. If you have E12506, the file size was never the issue and making it smaller will not change the type check.

Still not working?

If the file passes file, opens with real mail headers and is labelled message/rfc822 with a matching .eml filename, you have done everything on your side and the type is not enabled on the account. Prove it quickly by zipping the same file and sending that: if the archive goes through, the request is sound and only the type was blocking you. Then raise it with Kaleyra support, quoting the exact error and the content type, since the accepted list is not published anywhere. You can also submit your error to us for a tailored fix.

Was this fix helpful? Thanks for your feedback!