Skip to main content
About this page · Updated 2026-10-22 16:14 UTC

What this page is: Send PDF invoices and other attachments over SMTP, or over the HTTP API where enabled, from a transactional or general-purpose Motor Block - what is allowed, the real size ceiling, and the exact errors.

How far to trust this page: the build checked 5 names, paths, tools, scopes and error codes against the real product (0 do not match). Reviewed claim by claim on 2026-10-22 (documentation truth audit).

Updated 2026-10-22 16:14 UTCLatest change: Send Email pages: every field, shown the same wayRecently updated pages

Send Attachments

Attachments (an invoice PDF, a ticket, a report) are sent over SMTP, and over the HTTP Send API (POST /v1/send) on Motor Blocks where that is enabled; see Send attachments over HTTP. The plan limits, the size ceiling and the scans are the same on both doors.

What you need​

  • A Motor Block of type transactional or general_purpose. Both send attachments. A marketing Motor Block cannot send over SMTP at all (campaign mail goes through the Communications Block).
  • SMTP credentials for that block: mail.motorical.com, port 2587 (STARTTLS) or 2465 (implicit TLS). Ports 587 and 465 are a different service. See Authentication methods.
  • A plan that includes attachments.

Who decides what is allowed​

Two things decide, in this order:

  1. Your plan decides whether attachments are allowed at all, how many per message, the largest single file, and the total of all files in one message. These values change with the plans, so read them live and never copy them into code: GET https://motorical.com/api/billing/plans returns each plan's features.attachments (allowed, maxCount, maxSizePerFile and maxTotalSize, all sizes in bytes of the raw files before encoding).
  2. A platform ceiling on the whole encoded message sits above every plan's limits, so you normally meet your plan's limit first. Attachments are base64-encoded for transport, which adds about a third. If a message does reach the ceiling the 552 reply names it (see the table below).
  3. The recipient's mail provider has its own receive limit. Providers differ: Gmail accepts messages of up to 50 MB (it sends only up to 25 MB), while many corporate mail gateways and other providers stop at 20 to 25 MB of encoded message, which is roughly 15 to 18 MB of files. A message your plan accepts can still be refused later by a recipient whose provider has a lower limit (you will see a bounce), so send a download link for very large files.

The Motor Block type does not change any of this for transactional and general_purpose: the same plan limits apply to both.

What counts as an attachment​

Only real files count. These parts are always allowed and never count towards the plan's count or size limits:

  • inline images referenced from the HTML by Content-ID (a logo in a receipt)
  • calendar invitations (text/calendar)
  • cryptographic signatures and encryption parts (PGP, S/MIME)
  • delivery receipts

Dangerous file types are still screened by the content filter regardless of type. Every real attachment is also scanned for viruses before the message is accepted. A message that carries real attachments is judged by the general content bar whatever the Motor Block type: the lower bar that transactional blocks get for plain mail does not apply once files are attached.

Examples​

Keep credentials in environment variables, never in source code.

const nodemailer = require('nodemailer');

const transporter = nodemailer.createTransport({
host: 'mail.motorical.com',
port: 2587,
secure: false, // STARTTLS on 2587; use port 2465 with secure: true for implicit TLS
requireTLS: true,
auth: { user: process.env.MOTORICAL_SMTP_USER, pass: process.env.MOTORICAL_SMTP_PASSWORD },
});

await transporter.sendMail({
from: 'billing@yourdomain.com', // must be on the Motor Block's domain
to: 'customer@example.com',
subject: 'Your invoice',
text: 'Your invoice is attached.',
attachments: [{ filename: 'invoice-1001.pdf', path: './invoice-1001.pdf' }],
});

Errors and what to do​

The gateway answers during the SMTP conversation, so your library raises these as send errors.

ReplyMeaningFix
550 Email rejected: Attachments not included in <plan>. Upgrade for attachment support.The plan does not include attachments.Choose a plan with attachments.
550 Email rejected: Too many attachments (N). <plan> allows max M attachments.More files than the plan allows.Send fewer files per message, or combine them.
550 Email rejected: Attachment "<name>" too large (<KB>KB). <plan> limit: <MB>MB per file.One file exceeds the plan's per-file limit.Shrink or split the file.
550 Email rejected: Attachments exceed <plan>'s total of <MB>MB per message (this message: <MB>MB).The files together exceed the plan's per-message total.Send fewer or smaller files, or split them over several messages.
552 5.3.4 Message size exceeds limit (<N>MB)The whole encoded message is over the platform ceiling named in the reply. This is permanent: retrying the same message will never work.Send fewer or smaller files, or a download link instead.
552 5.3.4 An attachment is too large to be virus-scanned and cannot be deliveredA file is larger than the platform can scan. Permanent.Send a download link instead.
451 4.3.2 Attachment scanning is temporarily unavailable, please retry shortlyThe virus scan could not run. The message was not accepted. Temporary: your mail client or server retries on its own.Nothing; retry after a few minutes. Over HTTP the same condition is a 503 with Retry-After.
550 Email rejected: Attachments are not allowed on marketing motor blocks.Marketing blocks do not send attachments.Use the Communications Block for campaigns.

Send attachments over HTTP​

POST /v1/send takes an attachments list. It is rolling out per Motor Block: A Motor Block that has not been moved to the new sending path answers 422 with code feature_not_enabled and sends nothing (the fields are never silently dropped), so use SMTP there.

FieldRequiredMeaning
filenameYesThe name the recipient sees. No path separators or control characters.
contentYesThe file bytes as base64 (standard alphabet, no data: prefix; line breaks are tolerated).
contentTypeNoMIME type. Derived from the filename when omitted.
contentIdFor inline imagesReference the image in your HTML as <img src="cid:logo1">. Inline images do not count against the plan.
dispositionNoattachment (default) or inline; inline needs a contentId.
jq -n --arg content "$(base64 < invoice.pdf | tr -d '\n')" '{
from: "billing@yourdomain.com", fromName: "Acme Billing", to: "customer@example.com",
subject: "Your invoice", text: "Your invoice is attached.",
attachments: [{ filename: "invoice.pdf", content: $content, contentType: "application/pdf" }]
}' | curl -X POST "https://api.motorical.com/v1/send" \
-H "Authorization: ApiKey $MK_API_KEY" -H "Content-Type: application/json" --data-binary @-
import { readFile } from 'node:fs/promises';

const res = await fetch('https://api.motorical.com/v1/send', {
method: 'POST',
headers: { Authorization: `ApiKey ${process.env.MK_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
from: 'billing@yourdomain.com',
fromName: 'Acme Billing',
to: 'customer@example.com',
subject: 'Your invoice',
text: 'Your invoice is attached.',
attachments: [{ filename: 'invoice.pdf', content: (await readFile('invoice.pdf')).toString('base64') }],
}),
});
console.log(res.status, await res.json());

Things to know:

  • Base64 makes a file about a third bigger, and the plan limits count the real file size. The request body can be as large as the platform message capacity; above it the answer is 413 with error: "payload_too_large".
  • dryRun: true runs the same plan check and returns what would be attached (data.attachments, data.attachmentBytes), or the refusal a real send would get. It does not run the virus and content scan.
  • Every file is scanned for malware before the message is accepted, so a request with attachments takes longer to answer. If the scan cannot run, the answer is 503 with Retry-After and nothing is sent: retry with the same Idempotency-Key.
  • Only a few large requests run at a time for each Motor Block; an extra one gets 429 too_many_large_requests with Retry-After, and dryRun checks with large files are limited per minute (429 dryrun_rate_limited).
Answererror / codeMeaning and fix
413attachment_too_largeA file is over your plan's per-file limit. The body names the plan, the limit and the actual size.
413attachments_total_too_largeThe files together are over your plan's per-message total.
413payload_too_largeThe request body is over the platform message capacity. Send fewer or smaller files, or a download link.
422too_many_attachmentsMore files than your plan allows.
422attachment_type_not_allowedThe plan does not allow this file type.
422attachments_not_allowedThe plan or Motor Block type does not include attachments (a marketing block cannot send them).
422invalid_attachmentcontent is not valid base64; field names the attachment.
422content_policy_rejectedThe scan or content filter refused a file (malware, a blocked file type).
422feature_not_enabledAttachments are not enabled for this Motor Block yet. Use SMTP.
503temporarily_unavailableNothing was sent. Retry after Retry-After.

What else the HTTP API does and does not do​

POST /v1/send accepts from, fromName, to, cc, bcc, replyTo, subject, text, html, headers, attachments and dryRun. to, cc and bcc together take at most fifty addresses. cc, bcc, replyTo and attachments are rolling out per Motor Block, as above.

Through the headers object you can still set In-Reply-To, References, List-Unsubscribe and your own X- headers. A short list of headers that would let a message pretend to be someone else (From, Sender, Return-Path, To, Cc, Bcc, Subject, Date, Message-ID, the DKIM and authentication headers) is rejected.