JDBC Driver for SendGrid

Build 22.0.8462

SendMail

Sends a mail.

Procedure-Specific Information

The DynamicTemplateData input requires information about dynamic data of the template. Value for the different variables put into templates.

Example: {"fullname":"Test","paymenttotal":"Test","description":"Test"}

NOTE: The TemplateId column is required when using Dynamic Templates.

Process of adding Persanalizations object to SendMail Stored Procedure

SendMail Requires atleast one personalizations object in the request body and it can be added using the aggregate function.

For Example:

Using TEMP Tables.

Insert into To#TEMP(ToEmail,ToName) Values ('[email protected]','abc')

Insert into To#TEMP(ToEmail,ToName) Values ('[email protected]','xyz')

Insert into To#TEMP(ToEmail) Values ('[email protected]')

Insert into ToCC#TEMP(ToCCName,ToCCEmail) Values ('[email protected]','xyz')

Insert into ToBCC#TEMP(ToBCCEmail,ToBCCName) Values ('[email protected]','abc')

Insert into Content#TEMP(ContentValue,ContentType) Values ('[email protected]','text/plain')

Insert into Personalizations#TEMP(FromEmail,SendAt,FromName,Subject,To,ToCC,ToBCC)values('[email protected]','2017-10-30T10:57:00+01:00','hi','Test Subject2','To#TEMP','ToCC#TEMP','ToBCC#TEMP')

Exec SendMail Personalizations = 'Personalizations#TEMP', FromEmail='[email protected]', Subject='hello', Content='Content#TEMP' 

Using Aggregate values.

Send Mail to single Mail Address.

Insert into Personalizations#TEMP(FromEmail,SendAt,FromName,Subject,To,ToCC,ToBCC)values('[email protected]','2017-10-30T10:57:00+01:00','hi','Test Subject2',
         '[
		   {
              "ToEmail": "[email protected]",
              "ToName": "abc"
           }
		  ]',
		  '[
            {
              "ToCCName": "xyz",
              "ToCCEmail": "[email protected]"
            }
          ]',
		  '[
            {
              "ToBCCEmail": "[email protected]",
              "ToBCCName": "abcd"
            }
          ]')

Exec SendMail Personalizations = 'Personalizations#TEMP', FromEmail='[email protected]', Subject='hello', Content=
'{
  "ContentValue":"content",
  "ContentType":"text/plain"
}'

Send Mail to Multiple Mail Addresses.

Insert into Personalizations#TEMP(FromEmail,SendAt,FromName,Subject,To,ToCC,ToBCC)values('[email protected]','2017-10-30T10:57:00+01:00','hi','Test Subject2',
          '[
		    {
              "ToEmail": "[email protected]",
              "ToName": "abc"
            },
            {
              "ToEmail": "[email protected]",
              "ToName": "xyz"
            },
            {
              "ToEmail": "[email protected]"
            }
          ]',
		  '[
            {
              "ToCCName": "sac",
              "ToCCEmail": "[email protected]"
            }
          ]',
		  '[
            {
              "ToBCCEmail": "xyz",
              "ToBCCName": "[email protected]"
            }
          ]')
		  
Exec SendMail Personalizations = 'Personalizations#TEMP', FromEmail='[email protected]', Subject='hello', Content=
'{
  "ContentValue":"content",
  "ContentType":"text/html"
}'

Input

Name Type Required Description
Subject String True The subject of the mail to be sent.
ContentValue String False The content of the mail to be sent.
ContentType String False The type of content to be sent. supported values are text/plain and text/html
Content String True The aggregate for Content object
SendAt String False The date and time when you want your email to be delivered. Scheduling more than 72 hours in advance is forbidden.
FromEmail String True The email address of the sender.
FromName String False The name of the sender.
ToEmail String False Email address to send the mail to
ToName String False Email's respective names to send the mail to.
To String False The aggregate for To recipients
ToCCEmail String False Email address of the recipients who will receive a copy of your email
ToCCName String False Name of the recipients who will receive a copy of your email.
ToCC String False The aggregate for ToCC recipients.
ToBCCEmail String False Email address of the recipients who will receive a blind carbon copy of your email.
ToBCCName String False Name of the recipients who will receive a blind carbon copy of your email.
ToBCC String False The aggregate for ToBCC recipients.
ReplyToEmail String False The email address of the person to whom you are replying to.
ReplyToName String False The name of the person to whom you are replying to.
AttachmentPaths String False Path of the file to attach to the mail to be sent
TemplateId String False The Id of the template that you may want to send
DynamicTemplateData String False The data of the dynamic template.
Personalizations String True An array of messages and their metadata. Each object within personalizations can be thought of as an envelope - it defines who should receive an individual message and how that message should be handled.

Result Set Columns

Name Type Description
Success String Whether or not the mail was sent successfully.

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8462