SMTP Configuration
You are looking at an older version of the documentation. The latest version is found here.
For sending emails from the Data Virtuality Server, you will need to set up access to an SMTP server.
Pre-requisites
You can easily make use of the SMTP functionality of Data Virtuality. There are only a few things that you need to make sure of to activate and use this feature:
- A working SMTP server somewhere (hosted or on-premise)
- Access to the folder where the Data Virtuality Server is installed and write permission to its files
- The SMTP server has to be configured to accept incoming mail from the IP used by the Data Virtuality Server. This might be necessary to configure on very restrictive servers in terms of incoming SMTP connections.
Configuration Steps
Via Studio
The easiest way to configure your SMTP credentials is via the Data Virtuality Studio. Navigate to the Window menu item and select Preferences. Open the SMTP Configuration section and fill in your SMTP details.
Via SQL
You may also configure your SMTP credentials programmatically via SQL by calling the corresponding system procedure:
CALL "UTILS.setSmtpConfiguration"(
"hostname" => 'string_hostname',
"port" => integer_port,
"ssl" => boolean_ssl,
"starttls" => boolean_ssl,
"username" => 'string_username',
"password" => 'string_password',
"fromAddr" => 'string_fromAddr'
);;
fromAddr
parameter is mandatory since v2.4.2.3
sendMail
For sending emails, you can use the UTILS.sendMail
procedure. Here are several examples:
Simple plain text message
Simple mail
SELECT RESULT
FROM table(CALL "views.sendMail"(
"Recipient" => 'someone@somedomain.net',
"Subject" => 'testsubject',
"Body" => 'Some Content'
)) b;;
Reading the contents of a file and sending it as an attachment:
Sending mail with XML file attachment
WITH c AS (
SELECT *
FROM (CALL "file.getFiles"("pathAndPattern" => 'criteo.xml')) b
)
SELECT RESULT
FROM c,
TABLE(
CALL "views.sendMail"(
"Recipient" => 'someone@somedomain.net',
"Subject" => 'testsubject',
"Body" => 'Some Content',
"AttachmentNames"=> ARRAY(filePath),
"Attachments" => ARRAY(file),
"AttachmentMimeTypes" => ARRAY('text/xml')
)
) b;;
Sending an XLS file
WITH c AS (
SELECT *
FROM (CALL "file.getFiles"("pathAndPattern" => '../mattables.xls')) b
)
SELECT RESULT
FROM c,
TABLE(
CALL "views.sendMail"(
"Recipient" => 'someone@somedomain.net',
"Subject" => 'testsubject',
"Body" => 'Some Content',
"AttachmentNames" => ARRAY(filePath),
"Attachments" => ARRAY(file),
"AttachmentMimeTypes" => ARRAY('application/vnd.ms-excel')
)
) b;;