AppSynergy ERP
AppSynergy Platform
Resources
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.
Follow these steps:
To send a simple text email just insert a row into the parasql_email_out table like this:
Similar to the example above but with html_format set to TRUE:
In this example the parasql_user_email() function returns the email address of the currently logged in user.
To send an email with a document field attachment add a row to the parasql_email_out_attachment table as follows:
The following tables are used for sending and managing email. You can query them for diagnostic purposes.
| parasql_email_out | ||
|---|---|---|
| Column Name | Datatype | Comments |
| id | BIGINT NOT NULL AUTO_INCREMENT | Primary Key |
| status | ENUM('UNSENT','SENT','ERROR') NOT NULL DEFAULT 'UNSENT' | UNSENT, SENT, or ERROR |
| subject | VARCHAR(255) NOT NULL | Email subject. |
| body | MEDIUMTEXT NOT NULL | Email body as plain text or HTML. |
| html_format | BOOLEAN NOT NULL DEFAULT FALSE | Set to TRUE if body is in HTML format. |
| to_address | VARCHAR(255) NOT NULL | Comma 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_address | VARCHAR(255) | Comma or semicolon separated list of addresses. |
| replyto_address | VARCHAR(255) | Single address only. |
| from_address | VARCHAR(64) NOT NULL | Default Sender set via the Account Settings panel. Can be set programmatically to the current user by calling parasql_user_email(). |
| scheduled_on | DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP() | Time email was added to table (server time zone). |
| delay_until | DATETIME | Send immediately if null (server time zone). |
| sent_on | DATETIME | Time email was actually sent. |
| user_id | VARCHAR(64) NOT NULL DEFAULT USER() | User ID of sender. |
| transport | ENUM('Google','SendGrid') | Automatically managed by AppSynergy; do not change this value. |
| error_message | VARCHAR(512) | Error message text if send error. Automatically managed by AppSynergy; do not change this value. |
| parasql_email_out_attachment | ||
|---|---|---|
| Column Name | Datatype | Comments |
| id | BIGINT NOT NULL AUTO_INCREMENT | Primary Key |
| email_out_id | BIGINT NOT NULL REFERENCES parasql_email_out (id) ON DELETE CASCADE | References parasql_email_out.id |
| attachment | VARCHAR(512) NOT NULL COMMENT 'GCSFILE' | contents of a Document Field, Image Field or Signature Field |