SendMailMessage
Sends a message to the specified recipient.
ストアドプロシージャ固有の情報
このプロシージャを使用してE メールを送信します。
Example on how to include attachments:
By using JSON aggregates
{
"Attachments": [{"fileName": "filename", "data": "base64Encoded attachment content"}]
}
EXECUTE SendMailMessage @Subject = 'subject', @To = 'email', @From = 'sender_email', @CC = 'email', @BCC = 'email', @Content = 'content', @Attachments = "json aggregate"
By using temporary tables:
INSERT INTO Attachments#TEMP (FileName, Data) VALUES ('MyFile.txt', "base64Encoded data")
INSERT INTO Attachments#TEMP (FileName, Data) VALUES ('C:\\MyDirectory\\MyFile.extensio', "")
EXECUTE SendMailMessage @Subject = 'subject', @To = 'email', @From = 'sender_email', @CC = 'email', @BCC = 'email', @Content = 'content', @Attachments = "Attachments#TEMP"
The following scenarios still wok but are deprecated and will be removed in future releases.
ファイルを1つだけ添付する例です。
EXECUTE SendMailMessage @Subject = 'subject', @To = 'email', @From = 'sender_email', @CC = 'email', @BCC = 'email', @Content = 'content', @AttachmentPath = 'C:\\MyDirectory\\MyFile.extension'
ディレクトリの最初の階層の、すべてのファイルを添付する例です。
EXECUTE SendMailMessage @Subject = 'subject', @To = 'email', @From = 'sender_email', @CC = 'email', @BCC = 'email', @Content = 'content', @AttachmentPath = 'C:\\MyDirectory'
複数のファイルとフォルダを、組み合わせて添付する例です。
INSERT INTO attach#TEMP (AttachmentPath) VALUES ('C:\\MyDirectory\\MyFile.extension')
INSERT INTO attach#TEMP (AttachmentPath) VALUES ('C:\\MyDirectory2')
EXECUTE SendMailMessage @Subject = 'subject', @To = 'email', @From = 'sender_email', @CC = 'email', @BCC = 'email', @Content = 'content', @AttachmentPath = 'attach#TEMP'
複数のメール受信者を含める場合の例です。
EXECUTE SendMailMessage @Subject = 'subject', @To = '[email protected],[email protected]', @From = 'sender_email', @CC = '[email protected],[email protected]', @BCC = '[email protected],[email protected]', @Content = 'content'
Input
| Name | Type | Required | Description |
| Subject | String | True | The subject of the mail message. |
| To | String | True | The email address(es) of the recipient(s). |
| From | String | False | The email address of the sender. |
| CC | String | False | CCed recipient(s). |
| BCC | String | False | BCCed recipient(s). |
| Content | String | True | The message body. |
| AttachmentPath | String | False | The attachment file names (with the path if reading from a file) to include in the message. |
Result Set Columns
| Name | Type | Description |
| Id | String | The Id for the message as returned by the server. |