Sign in to fill these examples with your own keys. Sign in Start free trial

Attachments

MIME on SMTP, structured parts on HTTP inject, base64 on the REST send API.

Each send path takes files in a different shape. Pick the example for the path you use.

Attach over SMTP

Send multipart MIME in DATA. PostShiba does not rewrite attachment types. A message over 25 MB is rejected. See Send emails with SMTP.

send-with-attachment.sh
1swaks --server smtp.postshiba.com:587 --tls \ 2 --auth PLAIN --auth-user smtp_9 --auth-password YOUR_PASSWORD \ 3 --from hello@mail.example.com --to you@example.com \ 4 --header "Subject: PostShiba test" \ 5 --body "see attached" \ 6 --attach-name note.txt \ 7 --attach-type text/plain \ 8 --attach-body "hello"

Attach over HTTP inject

Pass content.attachments as an array of file_name, content_type, data, and base64. Set base64 to true when data is base64.

inject-with-attachment.sh
1curl -sS -u 'smtp_9:YOUR_PASSWORD' \ 2 -H 'Content-Type: application/json' \ 3 -d '{ 4 "envelope_sender": "hello@mail.example.com", 5 "content": { 6 "text_body": "see attached", 7 "headers": { 8 "From": "hello@mail.example.com", 9 "Subject": "PostShiba test" 10 }, 11 "attachments": [ 12 { 13 "file_name": "photo.png", 14 "content_type": "image/png", 15 "data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==", 16 "base64": true 17 } 18 ] 19 }, 20 "recipients": [{"email": "you@example.com"}] 21 }' \ 22 https://inject.postshiba.com/api/inject/v1

Attach over REST

Pass attachments as an array of filename, content_type, and base64 content.

send-with-attachment-rest.sh
1curl -sS -X POST \ 2 -H 'Authorization: Bearer YOUR_API_KEY' \ 3 -H 'Content-Type: application/json' \ 4 -d '{ 5 "from": "hello@mail.example.com", 6 "to": ["you@example.com"], 7 "subject": "PostShiba test", 8 "text": "see attached", 9 "attachments": [ 10 { 11 "filename": "photo.png", 12 "content_type": "image/png", 13 "content": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==" 14 } 15 ] 16 }' \ 17 https://app.postshiba.com/api/v1/emails
REST limit Value
Files per send 10
Size per file 18 MB
Size of all files 18 MB
Allowed types Images (JPEG, PNG, GIF, WebP, SVG, TIFF, BMP, HEIC, HEIF, AVIF), PDF, EPUB, Word, Excel, PowerPoint, OpenDocument, RTF, plain text, CSV, zip, .vcf, and .ics

filename is required, and its extension must match the file's contents: for example .jpg, .svg, .pdf, .epub, .docx, .xlsx, .csv, .zip, or .ics. A name like invoice.pdf.html is refused. PostShiba reads the type from the decoded bytes and sends the file with that type, whatever content_type says. A file it cannot identify is refused. A calendar invite must start with BEGIN:VCALENDAR.

A file that breaks a rule returns 422 invalid with field attachments. Files over 18 MB in total return 413 payload_too_large. The full field list is on Sending.

Files that arrive on inbound mail are covered on Receiving attachments.

Next steps