# `Sp_sendEmail_before` (procedure)

> 发送邮件模板


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | OUT | `sCode` | `int` |
| 2 | OUT | `sReturn` | `longtext` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_sendEmail_before`'`._

## Narrative

**Business context:** 系统管理 → 消息/邮件 — a documentation/example template (`COMMENT '发送邮件模板'`) showing how to enqueue an outbound email via the `syssendemail` queue. Not a production procedure: the values it inserts (sender `546625542@qq.com`, fixed work-order `SZPM22070353`, hard-coded `sReportId`, etc.) are illustrative, and the proc takes no input parameters apart from the two OUTs.

**What it does:** `INSERT INTO syssendemail` one row demonstrating every column the email-dispatch job consumes: `sTosAdressees` / `sCcssAdressees` / `sBccsAdressees` as `JSON_ARRAY(...)` of recipient addresses, `sTitle`, `sContent`, `sFileName`, `sFiles` as a `JSON_OBJECT` parameter map for the report renderer (`sReportId`, `sMaintableId`, `sModelsId`, `queryFilter`, etc.), and `sType=2` (text + attachment). The actual send is performed asynchronously by the WAR-side email consumer that polls `syssendemail`.

**Invocation:** No DB caller and no Java/XML reference in xly-src — only the upgrade script `script/标版/upgrade/更新WAR脚本/20230210_消息、工作流、定时 模块/Sp_sendEmail_before.sql` ships it. Status: documentation-only template — candidate for maintainer audit (move to a docs folder or drop, since shipping it as a callable proc invites accidental sends).
