Component: Email

 Show all Hide all

A component designed to send emails.

Component mode: Batch

Send mail from queues.

Supported modes: Batch | Legacy

Component settings

Maximum runtime
The duration in minutes after which the menu item stops asking for additional email messages to send. The accepted range is 2 to 15 minutes. Leave empty to use default setting of 10 minutes.

SQL

SQL Call: E-mails (mandatory)

Statement to extract e-mail information. Each row in the first resultset corresponds to an e-mail. Each row in the remaining resultsets corresponds to an attachment, and all attachments are attached to all e-mails.

The component will make this call repeatedly until it reaches maxminutes or receives an empty resultset.
Supports custom errors: No
May modify database: Yes

Parameters:

@StartTime mandatory datetime
Gives the point in time when the batchemail component started running and should be used to avoid trying to send the same e-mail message more than once during the same menuitem execution.

A good practice is to have a column with the name "DatetimeLastSendAttempt" (or similar) in your e-mail queue. In the stored procedure call where you feed the component with messages to send, you should only pick messages where DatetimeLastSendAttempt < @StartTime and then update DatetimeLastSendAttempt to GETDATE() for those messages before returning control back to the component.

Resultset: E-mail data

Resultset that contains e-mail data.
Repeat mode: 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.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).
from_name optional string
Assigns a human-friendly display name for the from address.
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).

Resultset: File attachments

Resultset with attached files.
Repeat mode: repeated exactly once
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

Resultset with attached menu items. You should only attach menu items with the Excel, RTF Document, PDF Document, or Zip Archive components.
Repeat mode: repeated exactly once
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.
menuitemid mandatory int
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-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).
Supports custom errors: No
May modify database: Yes

Parameters:

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

SQL Call: E-mail failed (mandatory)

Call made when an e-mail failed to be sent.
Supports custom errors: No
May modify database: Yes

Parameters:

@emailid mandatory string
ID returned from earlier SQL call
@errorcode mandatory int
Possible value Description
0 No error.
1 No recipients found.
-1 Unknown error.
2 The mail message contains invalid data such as NULL in body column.
3 At least one attachment wasn't generated correctly.
@errormessage mandatory string
Information that might be useful in figuring out what went wrong.

SQL Call: Validate parameters

Allows you to validate the parameters supplied by the user before any other SQL is run in the component. This call is only made if the component has visible parameters, the SQL is a stored procedure, and 'Validate parameters' is checked.
Supports custom errors: No
May modify database: No

Parameters:

@force optional bit
@validateparams mandatory bit
This parameter is set to 1 by Softadmin® when this call is made.

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'.
Supports custom errors: No
May modify database: Yes

Resultset: Access permissions

Return whether the user is allowed to visit the menu item with the current parameters.
Repeat mode: 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.