Send Mail
Name
send_mail
Description
Sends an email message. [API reference]
Related Tables
Parameters
Output Columns
Label | Data Type (SSIS) | Data Type (SQL) | Length | Raw | Description |
---|---|---|---|---|---|
Id |
DT_WSTR
|
nvarchar(4000)
|
4000 | False |
|
Response |
DT_WSTR
|
nvarchar(255)
|
255 | False |
Input Columns
Label | Data Type (SSIS) | Data Type (SQL) | Length | Raw | Description |
---|---|---|---|---|---|
Subject |
DT_WSTR
|
nvarchar(250)
|
250 | False |
|
BodyContentType |
DT_WSTR
|
nvarchar(8)
|
8 | False |
|
BodyContent |
DT_NTEXT
|
nvarchar(MAX)
|
False |
||
ToRecipients |
DT_WSTR
|
nvarchar(4000)
|
4000 | True |
|
CcRecipients |
DT_WSTR
|
nvarchar(4000)
|
4000 | True |
|
BccRecipients |
DT_WSTR
|
nvarchar(4000)
|
4000 | True |
|
InternetMessageHeaders |
DT_WSTR
|
nvarchar(4000)
|
4000 | True |
|
Attachments |
DT_NTEXT
|
nvarchar(MAX)
|
True |
||
Importance |
DT_WSTR
|
nvarchar(10)
|
10 | False |
|
IsDeliveryReceiptRequested |
DT_BOOL
|
bit
|
False |
||
IsReadReceiptRequested |
DT_BOOL
|
bit
|
False |
||
SaveToSentItems |
DT_BOOL
|
bit
|
False |
Examples
SSIS
Use Outlook Mail (Office 365) Connector in API Source component to read data or in API Destination component to read/write data:
Insert into MyMessages table using API Destination
This Endpoint belongs to MyMessages table, therefore you cannot work with it directly. Use this table and table-operation pair instead:

ODBC application
Use these SQL queries in your ODBC application data source:
Send a simple email message (with headers, HTML body, recipients, attachments and more)
This example shows how to send email using Office 365 API. It shows how to attach local file(s) as attachments. To send email as Text format use Text rather than HTML in BodyContentType value.
INSERT INTO MyMessages
(Subject, BodyContentType, BodyContent
, ToRecipients, CcRecipients, BccRecipients
, InternetMessageHeaders
, Attachments, Importance, IsDeliveryReceiptRequested, IsReadReceiptRequested
, SaveToSentItems)
VALUES
('Employee Reviews Scheduled', 'HTML', '<b>Hi All,</b> employee reviews have been scheduled. <span style="text-decoration: underline;">Please reflect this in your notes.</span>',
'[{ "emailAddress": { "address": "john.doe@domain.com" }}, { "emailAddress": { "address": "jane.doe@domain.com" }}]',
'[{ "emailAddress": { "address": "mary.dawson@domain.com" }}]',
'[{ "emailAddress": { "address": "ryan.connor@domain.com" }}]',
'[{ "name": "x-custom-header-group-name", "value": "Managers" }, { "name": "x-custom-header-group-id", "value":"MGR001" }]',
'[
{
"@odata.type": "#microsoft.graph.fileAttachment",
"name": "file1.txt",
"contentType": "text/plain",
"contentBytes": "<<c:\file1.txt,FUN_FILE_BASE64ENC>>"
},
{
"@odata.type": "#microsoft.graph.fileAttachment",
"name": "profile-picture.png",
"contentType": "image/png",
"contentBytes": "<<c:\profile-picture.png,FUN_FILE_BASE64ENC>>"
}
]',
'normal', 'false', 'false', 'true')
send_mail
endpoint belongs to
MyMessages
table(s), and can therefore be used via those table(s).
SQL Server
Use these SQL queries in SQL Server after you create a data source in Data Gateway:
Send a simple email message (with headers, HTML body, recipients, attachments and more)
This example shows how to send email using Office 365 API. It shows how to attach local file(s) as attachments. To send email as Text format use Text rather than HTML in BodyContentType value.
DECLARE @MyQuery NVARCHAR(MAX) = 'INSERT INTO MyMessages
(Subject, BodyContentType, BodyContent
, ToRecipients, CcRecipients, BccRecipients
, InternetMessageHeaders
, Attachments, Importance, IsDeliveryReceiptRequested, IsReadReceiptRequested
, SaveToSentItems)
VALUES
(''Employee Reviews Scheduled'', ''HTML'', ''<b>Hi All,</b> employee reviews have been scheduled. <span style="text-decoration: underline;">Please reflect this in your notes.</span>'',
''[{ "emailAddress": { "address": "john.doe@domain.com" }}, { "emailAddress": { "address": "jane.doe@domain.com" }}]'',
''[{ "emailAddress": { "address": "mary.dawson@domain.com" }}]'',
''[{ "emailAddress": { "address": "ryan.connor@domain.com" }}]'',
''[{ "name": "x-custom-header-group-name", "value": "Managers" }, { "name": "x-custom-header-group-id", "value":"MGR001" }]'',
''[
{
"@odata.type": "#microsoft.graph.fileAttachment",
"name": "file1.txt",
"contentType": "text/plain",
"contentBytes": "<<c:\file1.txt,FUN_FILE_BASE64ENC>>"
},
{
"@odata.type": "#microsoft.graph.fileAttachment",
"name": "profile-picture.png",
"contentType": "image/png",
"contentBytes": "<<c:\profile-picture.png,FUN_FILE_BASE64ENC>>"
}
]'',
''normal'', ''false'', ''false'', ''true'')';
EXEC (@MyQuery) AT [LS_TO_OUTLOOK_MAIL_OFFICE_365_IN_GATEWAY];
send_mail
endpoint belongs to
MyMessages
table(s), and can therefore be used via those table(s).