Email

A component designed to send emails.

Component modes: Batch | Legacy

Component mode: Legacy

Sends emails.

System Settings

The components uses system settings listed under the SMTP heading.

SMTPRelay is the most important, and is the address of the mail server.

SMTPLibrary lets you choose between

  • System.Net.Mail: Legacy mail library.
  • MailKit: More modern, and compatible with more mail servers.
  • Graph: Instead of sending mail over SMTP, send it through Microsoft.Graph.

Go to Admin > Local Settings in your system for a full list of settings.

SQL

SQL Call: Attachments (mandatory)

Statement to extract attachments in e-mails, each row corresponds to a file and each file will be attached to all e-mails. In order to use attachements you need to give the Internet User (IUSR_) permission to read, write and execute in the WINDOWS/TEMP directory.

You can either attach the result of another menu item or attach a file directly (or both, if you use more than one table in the resultset). Do not attach menu items that generate html, like grid.aspx.

May modify database: No

Parameters

@attachments bit
Set to 1 by component when trying to extract attachments.

Resultset: File attachment (optional)

Resultset with attached files.
Table count: repeated zero or more times
Row count: zero or more rows
Columns
ContentId optional string
Content-ID to give attachment, which must be a valid content-ID as defined in RFC 2111. Used to inline attachments in email body.
xxx mandatory binary
Contains a file that should be attached, component uses the first found image-column in resultset. Must not be NULL.
xxxfilename mandatory string
Contains the filename of the attached file. The column name should be the same as the image column name followed by 'filename'.

Resultset: Menu item attachments (optional)

Resultset with attached menu items.
Table count: repeated zero or more times
Row count: zero or more rows
Columns
ContentId optional string
Content-ID to give attachment, which must be a valid content-id as defined in RFC 2111.
Filename mandatory string
Filename to give attached menu item.
MenuItem optional string
Alias of menu item to use as attachment.
MenuItemId optional int
Deprecated. Use MenuItem instead.

Menu item to use as attachment.
PassingFields optional string
Passing fields that will be appended to the link if the attachment is a menu item. (e.g. x=3&y=4).

SQL Call: E-mails (mandatory)

Statement to extract e-mail information, each row corresponds to an e-mail.

When sending html e-mails the component will automatically insert <html>, <head> and <body> tags.

May modify database: Yes

Resultset: E-mail data

Resultset that contains e-mail data.
Table count: repeated exactly once
Row count: zero or more rows
Columns
alternative_plaintext optional bit
Used when sending e-mails that contains both an html and plain text version of the body. Use this column to specify that a plain text version of the message should automatically be generated from the html body. The plain text version will contain the same text as the html message but with all html tags removed except <br> and <p> tags, which will be replaced by newlines.
bcc optional string
The 'bcc' property in the email, if it contains more than 1 address then the addresses need to be separated with ';'.Only addresses containing standard 7-bit ASCII-characters are supported (thus the characters åäö are not supported).
body optional string
The 'body' property in the email. The body can contain tags in the format {XXX} that is replaced by the column with name 'XXX'.If this is an html e-mail the contents of this column will be inserted within the <body> section of the html document. You should not include your own <html>, <head> or <body> tags in this column.If this column is null it will be ignored.
body_html optional string
Used when sending e-mails with both html and plain text versions of the body. This column specifies the html version of the body.If this column is null it will be ignored.
body_plain optional string
Used when sending e-mails that contains both html and plain text versionis of the body. This column specifies the plain text version. You can also set the 'alternative_plaintext' column to automatically generate a plain text version of your message.If this column is null it will be ignored.
cc optional string
The 'cc' property in the email, if it contains more than 1 address then the addresses need to be separated with ';'.Only addresses containing standard 7-bit ASCII-characters are supported (thus the characters åäö are not supported).
css optional string
The stylesheet for the html message. Use one of the softadmin default stylesheets by calling dbo.ADMIN_GETCSS(@CSSID).The contents of this column will be inserted in the <head> section of the html document.
doctype optional string
Meta data preceeding the actual html document, e.g. <!DOCTYPE>. Only present in html messages.
emailid mandatory string
unique identifier for this email. You may never try to send the same email more than once during a single execution of batchemail.aspx, even if the first attempt to send the mail failed.
from mandatory string
The 'from' property in the email.Only addresses containing standard 7-bit ASCII-characters are supported (thus the characters åäö are not supported).
html optional bit
1 sets the 'bodyformat' property to html, 0 sets it to text. default is 1.
replyto optional string
The 'reply-to' property in the email.Only addresses containing standard 7-bit ASCII-characters are supported (thus the characters åäö are not supported).
subject mandatory string
The 'subject' property in the email.
to mandatory string
The 'to' property in the email, if it contains more than 1 address then the addresses need to be separated with ';'.Only addresses containing standard 7-bit ASCII-characters are supported (thus the characters åäö are not supported).
xxx optional string
0-n additional columns that replaces tags ( {XXX} ) in the body column.

SQL Call: E-mail sent (mandatory)

Statement that is executed after each e-mail to confirm that the email was sent (no resultset is expected), this database call is only executed if the column 'emailid' is returned in SQL (database call 2).

May modify database: Yes

Parameters

@emailid string
Contains the 'emailid'-column in SQL (database call 2) to confirm that this e-mail has been sent.

SQL Call: Confirmation message (mandatory)

Statement to extract confimation message after e-mail send out.

May modify database: Yes

Parameters

@finished bit
Set to '1' by component when retrieving confirmation message.

SQL Call: Validate parameters

Allows you to validate the SQL parameters before any other SQL is run in the component. This call is only made if the SQL is a stored procedure and Validate parameters is checked.

May modify database: No

Parameters

@Force bit
Set to 1 if the last call to validate parameters used admin_force and the user clicked OK in the OK/Cancel dialog.
@ValidateParams bit
Set to 1 when this call is made.

Resultset: Messages (optional)

Table count: repeated zero or one time
Row count: zero or one row
Columns
ADMIN_Force optional string
Message asking the end user to confirm their parameters.
ADMIN_Message optional string
Message explaining why the parameters are rejected.

Custom access control and logging

SQL Call: Custom access control and logging

Use this call to restrict which entries a user is allowed to view and edit, and to log which entries a user views.

Access to a menu item is normally controlled through functions and roles alone but some entities need more fine grained control. For example, a user may have access to the View Member menu item for normal members but not for members with a protected identity.

The menu items a user visits are always logged (in ADMINLogMenuItem) but for sensitive data you may need to log exactly what entries are viewed. Do the logging in this call as the common ways of viewing data (grid and InfoSQL) are not allowed to modify the database.

If you bind a scalar function instead of a stored procedure to this call then its name must end with '_GrantAccess'.

May modify database: Yes

Resultset: Access permissions

Return whether the user is allowed to visit the menu item with the current parameters.
Table count: repeated exactly once
Row count: exactly one row
Columns
GrantAccess mandatory bit
1 if the user is allowed to view the menu item, 0 if the user should not be allowed to view the menu item.

If 0 then an error will be logged as the user should not have been able to reach the menu item with the given parameters in the first place.