Endpoint Send a New Message for the specified User
Name
send_message
Description
Sends an email using specified user's mailbox. You can specify various parameters like subject, to , from while sending mail. It doesnt support attachments yet. [API reference]
Related Tables
MessageAttachments
, Messages
, MyMessages
Parameters
| Parameter | Required | Options | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
Name:
Label: To |
YES | |||||||||
|
Name:
Label: From |
||||||||||
|
Name:
Label: Cc |
||||||||||
|
Name:
Label: Bcc |
||||||||||
|
Name:
Label: ReplyTo |
||||||||||
|
Name:
Label: Subject |
||||||||||
|
Name:
Label: Body |
||||||||||
|
Name:
Label: MessageId |
||||||||||
|
Name:
Label: MimeType |
|
|||||||||
|
Name:
Label: ApiVersion The version of the API to use. |
||||||||||
|
Name:
Label: UserId Enter the Gmail user ID. |
|
Output Columns
| Label | Data Type (SSIS) | Data Type (SQL) | Length | Description |
|---|---|---|---|---|
| Id |
DT_WSTR
|
nvarchar(500)
|
500 | |
| Subject |
DT_WSTR
|
nvarchar(300)
|
300 | |
| BodySnippet |
DT_WSTR
|
nvarchar(4000)
|
4000 | |
| To |
DT_WSTR
|
nvarchar(200)
|
200 | |
| ToEmail |
DT_WSTR
|
nvarchar(200)
|
200 | |
| Date |
DT_WSTR
|
nvarchar(200)
|
200 | |
| From |
DT_WSTR
|
nvarchar(200)
|
200 | |
| FromEmail |
DT_WSTR
|
nvarchar(200)
|
200 | |
| PlainTextBody |
DT_NTEXT
|
nvarchar(MAX)
|
||
| HtmlBody |
DT_NTEXT
|
nvarchar(MAX)
|
||
| ContentType |
DT_WSTR
|
nvarchar(200)
|
200 | |
| LabelIds |
DT_WSTR
|
nvarchar(500)
|
500 | |
| ThreadId |
DT_WSTR
|
nvarchar(500)
|
500 | |
| PayloadMimeType |
DT_WSTR
|
nvarchar(200)
|
200 | |
| PayloadBodySize |
DT_I4
|
int
|
||
| SizeEstimate |
DT_I4
|
int
|
||
| HistoryId |
DT_WSTR
|
nvarchar(500)
|
500 | |
| InternalDate |
DT_WSTR
|
nvarchar(200)
|
200 | |
| MessageDate |
DT_DBTIMESTAMP
|
datetime
|
||
| GoogleSmtpSource |
DT_WSTR
|
nvarchar(4000)
|
4000 | |
| ReturnPath |
DT_WSTR
|
nvarchar(500)
|
500 | |
| ReceivedSPF |
DT_WSTR
|
nvarchar(500)
|
500 | |
| Rfc822MessageID |
DT_WSTR
|
nvarchar(200)
|
200 | |
| MIMEVersion |
DT_WSTR
|
nvarchar(20)
|
20 | |
| Mailer |
DT_WSTR
|
nvarchar(200)
|
200 | |
| ThreadIndex |
DT_WSTR
|
nvarchar(500)
|
500 | |
| ContentLanguage |
DT_WSTR
|
nvarchar(100)
|
100 |
Input Columns
| Label | Data Type (SSIS) | Data Type (SQL) | Length | Description |
|---|---|---|---|---|
| From |
DT_WSTR
|
nvarchar(300)
|
300 | |
| To |
DT_WSTR
|
nvarchar(1000)
|
1000 | |
| Cc |
DT_WSTR
|
nvarchar(300)
|
300 | |
| Bcc |
DT_WSTR
|
nvarchar(300)
|
300 | |
| ReplyTo |
DT_WSTR
|
nvarchar(1000)
|
1000 | |
| Subject |
DT_WSTR
|
nvarchar(1000)
|
1000 | |
| Body |
DT_NTEXT
|
nvarchar(MAX)
|
||
| MessageId |
DT_STR
|
varchar(4000)
|
4000 | |
| MimeType |
DT_STR
|
varchar(4000)
|
4000 |
Examples
SSIS
Use Gmail Connector in API Source or in API Destination SSIS Data Flow components to read or write data.
API Source
| Required Parameters | |
|---|---|
| To | Fill-in the parameter... |
| Optional Parameters | |
| From | me |
| Cc | |
| Bcc | |
| ReplyTo | |
| Subject | |
| Body | |
| MessageId | 1234@local |
| MimeType | text/html |
API Destination
This Endpoint belongs to the MessageAttachments table, therefore it is better to use it, instead of accessing the endpoint directly. Use this table and table-operation pair to send a new message for the specified user:
| Required Parameters | |
|---|---|
| To | Fill-in the parameter... |
| Optional Parameters | |
| From | me |
| Cc | |
| Bcc | |
| ReplyTo | |
| Subject | |
| Body | |
| MessageId | 1234@local |
| MimeType | text/html |
ODBC application
Use these SQL queries in your ODBC application data source:
Send a message
This example shows how to send an HTML email using Gmail REST API. It has multiple recepients, cc and bcc email ids. You can also set Reply-To email (other than From)
INSERT INTO Messages(From,To,Cc,Bcc,ReplyTo,Subject,Body,MimeType)
VALUES('me'
,'bob@zappysys.com,sam@zappysys.com'
,'some-cc1@zappysys.com,some-cc2@zappysys.com'
,'some-bcc1@zappysys.com,some-bcc1@zappysys.com'
,'reply-to@gmail.com'
,'This is sample HTML email'
,'This is <u>Bob''s</u> HTML email. Sent on <b>*** <<FUN_NOW>> ** </b>'
,'text/html' --or use text/plain for Plain format
)
/*
OR call using SELECT statement
SELECT * FROM send_message
WITH(From='me'
,To='bob@zappysys.com,sam@zappysys.com'
,Cc='some-cc1@zappysys.com,some-cc2@zappysys.com'
,Bcc='some-bcc1@zappysys.com,some-bcc1@zappysys.com'
,ReplyTo='reply-to@gmail.com'
,Subject='This is sample HTML email'
,Body='This is <u>Bob''s</u> HTML email. Sent on <b>*** <<FUN_NOW>> ** </b>'
,MimeType='text/html' --or use text/plain for Plain format
)
*/
Send a message
This example shows how to send an HTML email using Gmail REST API. It has multiple recepients, cc and bcc email ids. You can also set Reply-To email (other than From)
INSERT INTO Messages(From,To,Cc,Bcc,ReplyTo,Subject,Body,MimeType)
VALUES('me'
,'bob@zappysys.com,sam@zappysys.com'
,'some-cc1@zappysys.com,some-cc2@zappysys.com'
,'some-bcc1@zappysys.com,some-bcc1@zappysys.com'
,'reply-to@gmail.com'
,'This is sample HTML email'
,'This is <u>Bob''s</u> HTML email. Sent on <b>*** <<FUN_NOW>> ** </b>'
,'text/html' --or use text/plain for Plain format
)
/*
OR call using SELECT statement
SELECT * FROM send_message
WITH(From='me'
,To='bob@zappysys.com,sam@zappysys.com'
,Cc='some-cc1@zappysys.com,some-cc2@zappysys.com'
,Bcc='some-bcc1@zappysys.com,some-bcc1@zappysys.com'
,ReplyTo='reply-to@gmail.com'
,Subject='This is sample HTML email'
,Body='This is <u>Bob''s</u> HTML email. Sent on <b>*** <<FUN_NOW>> ** </b>'
,MimeType='text/html' --or use text/plain for Plain format
)
*/
send_message endpoint belongs to
MessageAttachments
, Messages
, 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 message
This example shows how to send an HTML email using Gmail REST API. It has multiple recepients, cc and bcc email ids. You can also set Reply-To email (other than From)
DECLARE @MyQuery NVARCHAR(MAX) = 'INSERT INTO Messages(From,To,Cc,Bcc,ReplyTo,Subject,Body,MimeType)
VALUES(''me''
,''bob@zappysys.com,sam@zappysys.com''
,''some-cc1@zappysys.com,some-cc2@zappysys.com''
,''some-bcc1@zappysys.com,some-bcc1@zappysys.com''
,''reply-to@gmail.com''
,''This is sample HTML email''
,''This is <u>Bob''''s</u> HTML email. Sent on <b>*** <<FUN_NOW>> ** </b>''
,''text/html'' --or use text/plain for Plain format
)
/*
OR call using SELECT statement
SELECT * FROM send_message
WITH(From=''me''
,To=''bob@zappysys.com,sam@zappysys.com''
,Cc=''some-cc1@zappysys.com,some-cc2@zappysys.com''
,Bcc=''some-bcc1@zappysys.com,some-bcc1@zappysys.com''
,ReplyTo=''reply-to@gmail.com''
,Subject=''This is sample HTML email''
,Body=''This is <u>Bob''''s</u> HTML email. Sent on <b>*** <<FUN_NOW>> ** </b>''
,MimeType=''text/html'' --or use text/plain for Plain format
)
*/';
EXEC (@MyQuery) AT [LS_TO_GMAIL_IN_GATEWAY];
Send a message
This example shows how to send an HTML email using Gmail REST API. It has multiple recepients, cc and bcc email ids. You can also set Reply-To email (other than From)
DECLARE @MyQuery NVARCHAR(MAX) = 'INSERT INTO Messages(From,To,Cc,Bcc,ReplyTo,Subject,Body,MimeType)
VALUES(''me''
,''bob@zappysys.com,sam@zappysys.com''
,''some-cc1@zappysys.com,some-cc2@zappysys.com''
,''some-bcc1@zappysys.com,some-bcc1@zappysys.com''
,''reply-to@gmail.com''
,''This is sample HTML email''
,''This is <u>Bob''''s</u> HTML email. Sent on <b>*** <<FUN_NOW>> ** </b>''
,''text/html'' --or use text/plain for Plain format
)
/*
OR call using SELECT statement
SELECT * FROM send_message
WITH(From=''me''
,To=''bob@zappysys.com,sam@zappysys.com''
,Cc=''some-cc1@zappysys.com,some-cc2@zappysys.com''
,Bcc=''some-bcc1@zappysys.com,some-bcc1@zappysys.com''
,ReplyTo=''reply-to@gmail.com''
,Subject=''This is sample HTML email''
,Body=''This is <u>Bob''''s</u> HTML email. Sent on <b>*** <<FUN_NOW>> ** </b>''
,MimeType=''text/html'' --or use text/plain for Plain format
)
*/';
EXEC (@MyQuery) AT [LS_TO_GMAIL_IN_GATEWAY];
send_message endpoint belongs to
MessageAttachments
, Messages
, MyMessages
table(s), and can therefore be used via those table(s).