Application Programming Interface Guide > Built-in Procedures > Procedures Reference > SendResultsInEMail
 
SendResultsInEMail
Send an email message with the specified headers and content, and with the results of the given view or procedure as attachments.
The option keywords are used to control behavior. If options is NULL, the default is SUMMARY, CSV_ATTACH. The options are:
CSV_ATTACH: Causes cursor result sets to be attached as CSV files.
SEND_ERROR: Causes any errors from the executed procedure or table to be sent instead of being reported as an exception.
SKIP_IF_NO_RESULTS: Sends no email if there are zero results.
SUMMARY: Appends a summary of the results to the message content.
Location
/lib/resource/
Inputs
from: The address the message is from. NULL causes use of the server’s configured from-address. Only NULL is supported.
replyTo: The address to place in the replyTo field of the message.
to: A comma-separated list of email addresses.
cc: A comma-separated list of email addresses.
bcc: A comma-separated list of email addresses.
subject: The message subject.
contentType: This can be TEXT_PLAIN or TEXT_HTML.
content: The message body.
path: The path to a view or procedure to execute.
type: Either TABLE or PROCEDURE, as appropriate.
parameters: If executing a PROCEDURE with any parameters, this is a comma-separated list of parameter values. Otherwise this should be NULL.
options: A comma-separated list of option keywords.
Outputs
N/A
Exceptions
IllegalArgumentException: If from is not NULL.
IllegalArgumentException: If any of the address lines are manformed.
IllegalArgumentException: If to, cc, and bcc are all NULL.
IllegalArgumentException: If there is more than one address in replyTo.
IllegalArgumentException: If contentType is not TEXT_PLAIN or TEXT_HTML.
IllegalArgumentException: If type is not TABLE or PROCEDURE.
IllegalArgumentException: If path is malformed.
IllegalArgumentException: If parameters does not contain the right number or type of parameter values.
IllegalArgumentException: If options contains any unknown options.
IllegalStateException: If the server’s from-address is not configured.
NotFoundException: If the specified view or procedure does not exist.
SecurityException: If the user does not have READ permission on all items in path other than the last one.
SecurityException: If the user does not have EXECUTE or SELECT permission on the last item in the list as appropriate.