[API]发邮件#

Data: 2026-06-11 15:06:51

curl 测试#

秘钥,是化名,加上我常用的那三个数字

1. 最小测试#


curl -X POST "https://mailapi.ccgxk.com/send-mail" \
-H "Content-Type: application/json" \
-H "X-API-Key: 秘钥" \
-d '{
"to": "kohunglee@gmail.com",
"subject": "测试邮件",
"text": "这是一封测试邮件"
}'

2. 完整测试#


curl -X POST "https://mailapi.ccgxk.com/send-mail" \
-H "Content-Type: application/json" \
-H "X-API-Key: 秘钥" \
-d '{
"from": "Sender <your_email@example.com>",
"fromName": "Sender",
"to": ["receiver1@example.com", "receiver2@example.com"],
"cc": "cc1@example.com,cc2@example.com",
"bcc": ["bcc@example.com"],
"replyTo": "reply@example.com",
"subject": "带高级参数的测试邮件",
"text": "纯文本正文",
"html": "<p>HTML 正文</p>",
"headers": {
"X-Custom-Header": "hello"
},
"priority": "high",
"envelope": {
"from": "bounce@example.com",
"to": ["receiver1@example.com"]
},
"messageId": "<custom-message-id@example.com>",
"attachments": [
{
"filename": "hello.txt",
"content": "hello attachment"
}
]
}'

返回示例#


{

"ok": true,

"messageId": "<...>",

"envelope": {

"from": "...",

"to": ["..."]

},

"accepted": ["kohunglee@gmail.com"],

"rejected": [],

"requestId": "..."

}

.


kehongli@kehongdeMacBook-Air ~ % curl -X POST “https://mailapi.ccgxk.com/send-mail" \

  -H “Content-Type: application/json” \

  -H “X-API-Key: wanghao123” \

  -d ‘{

    “to”: “kohunglee@gmail.com”,

    “subject”: “最后 我再试试 次,上海服务器测试邮件”,

    “text”: “这是一封测试邮件, 来自 上海狗狗 服务器。”

  }’

{

  “ok”: true,

  “messageId”: “ff75ad6d-3334-850c-0f8f-725ebc34626d@163.com”,

  “envelope”: {

    “from”: “kohunglee@163.com”,

    “to”: [

      “kohunglee@gmail.com

    ]

  },

  “accepted”: [

    “kohunglee@gmail.com

  ],

  “rejected”: [],

  “requestId”: “ffb302fb-a87a-437f-b5e0-2cda4fef954e”

}


kehongli@kehongdeMacBook-Air ~ % curl -X POST “https://mailapi.ccgxk.com/send-mail" \

-H “Content-Type: application/json” \

-H “X-API-Key: wanghao123” \

-d ‘{

“to”: “kohunglee@gmail.com”,

“subject”: “确认万无一失,测试邮件”,

“text”: “这是一封测试邮件”

}’

{

  “ok”: false,

  “error”: “Unauthorized”,

  “requestId”: “3cd66c64-35e9-4e4c-8a50-847ff803499e”

}zsh: command not found: -H

zsh: command not found: -H

zsh: command not found: -d

- end -#

© 2025 –   海牧羽工厂 HMY Factory