我m curruntly migrating oracle schema to postgresql 9.5 . I
使用Ora2pg,它为我转换了一个函数,可以将邮件发送到pgplsql。我的代码:
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
;
但是我得到了下一个错误:
ERROR: schema "utl_smtp" does not exist
LINE 28: V_Conn UTL_SMTP.CONNECTION;
我可以导入任何UTL_SMTP
包/架构吗?我需要做些什么更改才能通过postgresql
发送邮件?