ALTER PROCEDURE "dba"."saadameilid"( in a_mess long varchar)
BEGIN
DECLARE to_list LONG VARCHAR;
DECLARE email_subject CHAR(256);
DECLARE content LONG VARCHAR;
DECLARE uid CHAR(20);

SET to_list='info@pmen.ee';
//SET to_list='raidisaar@gmail.com';
SET email_subject='Kätsetus';
SET uid='raidi@pmen.ee'; 

// Call xp_startsmtp to start an SMTP email session
CALL xp_startsmtp( smtp_sender=uid, smtp_server='smtp.neuron.ee', smtp_port=25, smtp_auth_username=uid, smtp_auth_password='vQB5dcPwd' );


/*

// Basic email example
SET content='See on sisu.\n'; 
CALL xp_sendmail( recipient=to_list,
     subject=email_subject,
     "message"=content ); 
*/

// Send email containing HTML using the content_type parameter,
// as well as including an attachment with the include_file
// parameter
//SET content='Plain text.<BR><BR><B>Bold text.</B><BR><BR><a href="www.iAnywhere.com">iAnywhere Home Page</a></B><BR><BR>';
/*CALL xp_sendmail( recipient=to_list,
     subject=email_subject,
     "message"=content,
     content_type = 'text/html',
     include_file = 'test.zip' ); 

*/

CALL xp_sendmail( recipient=to_list,
     subject=email_subject,
     "message"=a_mess,
     content_type = 'text/html'); 



/*
// Send email "ASIS".  Here the content-type has been specified
// by the user as part of email body.  Note the attachment can
// also be done separately
SET content='Content-Type: text/html;\nContent-Disposition: inline; \n\nThis text 
 is not bold<BR><BR><B>This text is bold</B><BR><BR><a href="www.iAnywhere.com">iAnywhere Home 
 Page</a></B><BR><BR>';
CALL xp_sendmail( recipient=to_list,
     subject=email_subject,
     "message"=content,
     content_type = 'ASIS',
     include_file = 'test.zip' ); 

// Send email "ASIS" along with an include file.  Note that  
// "message" contains the information for another attachment
SET content = 'Content-Type: multipart/mixed; boundary="xxxxx";\n';
SET content = content || 'This part of the email should not be shown.  If this is shown 
 then the email client is not MIME compatible\n\n';
SET content = content || '--xxxxx\n';
SET content = content || 'Content-Type: text/html;\n';
SET content = content || 'Content-Disposition: inline;\n\n';
SET content = content || 'This text is not bold<BR><BR><B>This text is bold</B><BR>
 <BR><a href="www.iAnywhere.com">iAnywhere Home Page</a></B><BR><BR>\n\n';
SET content = content || '--xxxxx\n'; 
SET content = content || 'Content-Type: application/zip; name="test.zip"\n';
SET content = content || 'Content-Transfer-Encoding: base64\n';
SET content = content || 'Content-Disposition: attachment; filename="test.zip"\n\n';

// Encode the attachment instead of adding this one in 
// the include_file parameter
SET content = content || base64_encode( xp_read_file( 'othertest.zip' ) ) || '\n\n';
SET content = content || '--xxxxx--\n'; 
CALL xp_sendmail( recipient=to_list,
      subject=email_subject,
      "message"=content,
      content_type = 'ASIS',
      include_file = 'othertest.zip' );
*/

// End the SMTP session
    CALL xp_stopsmtp();
END