Sends an email to one address, using an HTML template or plain text. This is a server-side endpoint and must be signed.
Content-Type: application/json
Request
| Field | Required | Description |
|---|---|---|
appId / timestamp / nonce / sign | Yes | Common signing parameters |
to | Yes | Recipient address; one recipient per request |
templateCode | No | Template code: an app template you created in the console, or a built-in template below. With a template, subject and body come from the template |
subject | No | Subject line. Recommended when not using a template |
text | No | Plain-text body; content is an alias |
appName | No | App name {app} used in templates, default 「应用通知」 |
variables | No | Template variables as a JSON object, e.g. {"orderNo": "P001", "amount": "99.00"}. A JSON string is also accepted |
code / name / link / content | No | Shortcuts for common variables; variables wins on conflicts |
fromTitle | No | Sender display name. Use your app or brand name |
appCode | No | App to bill. When set, the email is charged |
Templates
In the console, go to Email → Templates to create, edit and disable templates per app, with live preview and test sends.
| Feature | Details |
|---|---|
| Format | HTML body + plain-text body (generated from HTML if left empty), sent as a multipart email |
| Variables | Write {name} in the subject and body and pass values in variables; {app} becomes your app name |
| Escaping | Variable values are HTML-escaped, so callers cannot inject markup |
| Safety | <script>, <iframe>, <form>, event attributes and javascript: links are removed on save; HTML emails end with a "Sent by app via FoOTOo Cloud" line |
| Precedence | For the same templateCode: app template → platform template → built-in |
| Scope | App templates apply to signed calls only |
Example: custom template
Assume you created order_paid in the console with the subject {app} order {orderNo} paid:
BODY=$(python3 -c '
import json, footoo_sign
print(json.dumps(footoo_sign.signed({
"to": "user@example.com",
"templateCode": "order_paid",
"variables": {"orderNo": "P202611170001", "amount": "99.00"},
"appCode": "<appCode>",
}, "ak_xxx", "<appSecret>"), ensure_ascii=False))')
curl -s -X POST https://cloud.ifootoo.com/client/open/mail/v1/send \
-H 'Content-Type: application/json' -d "$BODY"
variables is a nested object, so it is signed as compact JSON with sorted keys per the signing algorithm. The reference implementations handle this.
Built-in templates
Template text is in Chinese.
| templateCode | Subject | Body (meaning) | Variables |
|---|---|---|---|
verify_code | {app} 验证码 | Your code is {code}, valid for 5 minutes. Ignore this email if you did not request it. | code |
welcome | 欢迎使用 {app} | Hello {name}, your {app} account is ready. | name |
reset_password | {app} 重置密码 | Use this link to reset your password within 30 minutes: {link} | link |
notify | {app} 通知 | {content} | content or text |
A code that is neither an app template nor a built-in returns 不支持的邮件模板 (unsupported template). For English emails, create your own template in the console.
Notes
- HTML via templates. Sending
subject+textdirectly produces plain text; use a template for HTML. - Price: CNY 0.01 per email, deducted from the
appCodebalance before sending and refunded if sending fails. - Sender address: provided by the platform; customize the display name with
fromTitle. - Delivery: success means the mail server accepted the message, not that it reached the inbox.
Example
BODY=$(python3 -c '
import json, footoo_sign
print(json.dumps(footoo_sign.signed({
"to": "user@example.com",
"subject": "Your Acme verification code",
"text": "Your code is 482913. It expires in 5 minutes.",
"fromTitle": "Acme",
"appCode": "<appCode>",
}, "ak_xxx", "<appSecret>"), ensure_ascii=False))')
curl -s -X POST https://cloud.ifootoo.com/client/open/mail/v1/send \
-H 'Content-Type: application/json' -d "$BODY"
Success:
{"code":200,"msg":"邮件已受理","type":"SUCCESS","data":{"to":"user@example.com"}}
To email the signed-in user from a frontend-only app, use mail/self in Session capabilities. Your appSecret never reaches the browser.