Sign In

Outbound Mail

You can use AppSynergy's outbound mail features to send notification emails from your triggers and other PL/SQL code. In order to send email you must first create a SendGrid account and then link that account to AppSynergy.

Linking AppSynergy to SendGrid

Follow these steps:

Example: Text Email

To send a simple text email just insert a row into the parasql_email_out table like this:

INSERT INTO parasql_email_out (to_address, subject, body) VALUES ('joe@xyzdomain.com', 'My subject', 'Hello World');

Example: HTML Email

Similar to the example above but with html_format set to TRUE:

INSERT INTO parasql_email_out (from_address, to_address, subject, body, html_format) VALUES (parasql_user_email(), 'joe@xyzdomain.com', 'My subject', '<h1>HTML email body</h1>', TRUE);

In this example the parasql_user_email() function returns the email address of the currently logged in user.

Example: Email with Attachment

To send an email with a document field attachment add a row to the parasql_email_out_attachment table as follows:

BEGIN DECLARE v_attachment VARCHAR(512); -- get document for attachment SELECT MyDocumentField INTO v_attachment FROM MyTable WHERE MyTable_ID = 1234; -- create the email INSERT INTO parasql_email_out (from_address, to_address, subject, body) VALUES (parasql_user_email(), 'joe@xyzdomain.com', 'My subject', 'My body...'); -- add the attachment INSERT INTO parasql_email_out_attachment (email_out_id, attachment) VALUES (last_insert_id(), v_attachment); END

Outbound Mail Tables

The following tables are used for sending and managing email. You can query them for diagnostic purposes.

parasql_email_out
Column NameDatatypeComments
idBIGINT NOT NULL AUTO_INCREMENTPrimary Key
statusENUM('UNSENT','SENT','ERROR') NOT NULL DEFAULT 'UNSENT'UNSENT, SENT, or ERROR
subjectVARCHAR(255) NOT NULLEmail subject.
bodyMEDIUMTEXT NOT NULLEmail body as plain text or HTML.
html_formatBOOLEAN NOT NULL DEFAULT FALSESet to TRUE if body is in HTML format.
to_address VARCHAR(255) NOT NULLComma or semicolon separated list of addresses; joe.blow@somedomain.com or Joe Blow <joe.blow@somedomain.com>
cc_address VARCHAR(255)Comma or semicolon separated list of addresses.
bcc_addressVARCHAR(255)Comma or semicolon separated list of addresses.
replyto_addressVARCHAR(255)Single address only.
from_addressVARCHAR(64) NOT NULLRestricted to approved senders. Typically set via the parasql_user_email() function or hard coded to something like noreply@mydomain.com
scheduled_onDATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP()Time email was added to table (server time zone).
delay_untilDATETIMESend immediately if null (server time zone).
sent_onDATETIMETime email was actually sent.
user_idVARCHAR(64) NOT NULL DEFAULT USER()User ID of sender.
unsubscribe_groupsVARCHAR(128)DEPRECATED. SendGrid only. Semicolon separated list of SendGrid Unsubscribe Group IDs.
enable_trackingBOOLEAN NOT NULL DEFAULT FALSEDEPRECATED. SendGrid only. Enable SendGrid click tracking and open tracking.
substitutionsVARCHAR(512)DEPRECATED. SendGrid only. Email substitutions as key=value;key=value; string.
transportENUM('Google','SendGrid')Automatically managed by AppSynergy; do not change this value.
error_messageVARCHAR(512)Error message text if send error. Automatically managed by AppSynergy; do not change this value.
parasql_email_out_attachment
Column NameDatatypeComments
idBIGINT NOT NULL AUTO_INCREMENTPrimary Key
email_out_idBIGINT NOT NULL REFERENCES parasql_email_out (id) ON DELETE CASCADEReferences parasql_email_out.id
attachmentVARCHAR(512) NOT NULL COMMENT 'GCSFILE'contents of a Document Field, Image Field or Signature Field