[NEW][VSQL] MAIL Command

We have add a new command for Valentina SQL.

The main goal is to be able use Valentina Server as generator of PDF and/or HTML reports and sending them by email directly from VSERVER’s stored procedure. Besides, this command can be called by Event Scheduler of VSERVER or by a database or table trigger.

vext_mail
 : __MAIL
   __FROM character_string_literal_or_var 
   __TO character_string_literal_or_var 
   __SUBJECT character_string_literal_or_var
   __BODY character_string_literal_or_var
  [__ATTACH vext_attach_list]
      __SMTP character_string_literal_or_var
      __PORT character_string_literal_or_var
     [__USER character_string_literal_or_var,
      __PASSWORD character_string_literal_or_var]
     [__SSL truth_value_or_var]

vext_attach_list
 : character_string_literal_or_var AS character_string_literal_or_var , ...

character_string_literal_or_var
 : character_string_literal
 | variable_name

uint_or_var
 : UINT
 | variable_name

truth_value_or_var
 : truth_value
 | variable_name

truth_value
 : TRUE
 | FALSE

Example:

CREATE PROCEDURE MAIL_PERSONS()
BEGIN
    DECLARE cur1 CURSOR FOR 
        SELECT f1, f2, f3 FROM tblPerson WHERE fldBirthDate = '2000-01-01'
        FOR REPORT proj_person.person_list AS PDF ENCODE BASE64;

    OPEN cur1; 
        FETCH FIRST cur1 INTO @report1_data; 
    CLOSE cur1; 

   __MAIL 
       __FROM 'support@company.com' 
       __TO 'client_name@client.com'
       __SUBJECT 'Persons that was born at New Year 2000'
       __BODY 'Please check attached PDF file.'
       __ATTACH @report1_data as 'person_list.pdf'
       __SMTP 'smtp://smpt.company.com' 
       __PORT '579'
END

Published by

Ruslan Zasukhin

VP Engineering and New Technology Paradigma Software, Inc

2 thoughts on “[NEW][VSQL] MAIL Command”

Comments are closed.