Im curruntly migrating oracle schema to postgresql 9.5 . I
m using Ora2pg and it converted for me one function which is reponsible for sending mail to pgplsql. My code :
CREATE OR REPLACE FUNCTION Control_Reports_Pg.send_error_mail (P_Str text,
P_Function_Name text ) RETURNS VOID AS $body$
DECLARE
V_Mail_Sender varchar(100) :=
'<BezeqInternational@bezeqint.co.il>';
V_Mail_Recipients varchar(100) :=
'<marinar@gmail.com>';
V_Mail_Subject varchar(250):='Error in
'||C_Package_Name||'.'||P_Function_Name;
V_Conn UTL_SMTP.CONNECTION;
BEGIN
V_Conn := Sa_Mail_Api_Pg.Begin_Mail(
Sender => V_Mail_Sender,
Recipients => V_Mail_Recipients,
Subject=>V_Mail_Subject,
Mime_Type => 'text/html; charset=windows-1255');
Sa_Mail_Api_Pg.Write_Mb_Text(
Conn => V_Conn,
Message => P_Str);
Sa_Mail_Api_Pg.End_Mail( Conn => V_Conn );
PERFORM
UTL_FILE.PUT_LINE(current_setting('Control_Reports_Pg.G_Log_File_Type');
END;
$body$
LANGUAGE PLPGSQL
SECURITY DEFINER
;
But i'm getting the next error :
ERROR: schema "utl_smtp" does not exist
LINE 28: V_Conn UTL_SMTP.CONNECTION;
Is there any UTL_SMTP
package / schema that i can import ? What changes i need to do in order to send mail via postgresql
?