Ошибка Happend после вызова процедуры отправки почты - PullRequest
0 голосов
/ 20 февраля 2019

Я создал процедуру с именем send_mail в sql developer oracle, которая написана ниже.

create or replace procedure Send_Mail(Msg_To varchar2, Msg_Subject varchar2, Msg_Text varchar2) is

    c        Utl_Smtp.Connection;
    Rc       integer;
    Msg_From varchar2(50) := 'it.dev23@dawateislami.net'; -- email of my company which hosted on Gmail
    Mailhost varchar2(30) := 'smtp.gmail.com';


begin
    c := Utl_Smtp.Open_Connection(Mailhost, 587);
    Utl_Smtp.Ehlo(c, Mailhost);
    Utl_Smtp.StartTLS(c);
    Utl_Smtp.Ehlo(c, Mailhost);
    Utl_Smtp.Mail(c, Msg_From);
    Utl_Smtp.Rcpt(c, Msg_To);

    Utl_Smtp.Data(c,
                  'From: Oracle Database' || Utl_Tcp.Crlf || 'To: ' || Msg_To || Utl_Tcp.Crlf || 'Subject: ' || Msg_Subject || Utl_Tcp.Crlf ||
                  Msg_Text);
    Utl_Smtp.Quit(c);

exception
    when Utl_Smtp.Invalid_Operation then
        Dbms_Output.Put_Line(' Invalid Operation in Mail attempt 
using UTL_SMTP.');
    when Utl_Smtp.Transient_Error then
        Dbms_Output.Put_Line(' Temporary e-mail issue - try again');
    when Utl_Smtp.Permanent_Error then
        Dbms_Output.Put_Line(' Permanent Error Encountered.');
end;

И когда я пытаюсь вызвать процедуру для отправки электронной почты, она выдает ошибку, пожалуйста, помогите мне, я хочуотправить письмо. Позвольте мне знать, где моя ошибка.У меня есть все команды

GRANT EXECUTE ON UTL_TCP  TO admonline;
GRANT EXECUTE ON UTL_SMTP TO admonline;
GRANT EXECUTE ON UTL_MAIL TO admonline;
GRANT EXECUTE ON UTL_http TO admonline;
--Calling procedure
BEGIN
send_mail(msg_to      => 'waqasprince911@gmail.com',
          msg_subject => 'Test subject',
          msg_text    => 'Test text');
END;   

Ошибка:

 Certificate validation failure
    ORA-06512: at "SYS.UTL_TCP", line 59
    ORA-06512: at "SYS.UTL_TCP", line 284
    ORA-06512: at "SYS.UTL_SMTP", line 284
    ORA-06512: at "SYS.UTL_SMTP", line 289
    ORA-06512: at "ADMONLINE.SEND_MAIL", line 11
    ORA-06512: at line 2
    29024. 00000 -  "Certificate validation failure"

    *Cause:    The certificate sent by the other side could not be validated. This may occur if
               the certificate has expired, has been revoked, or is invalid for another reason.

    *Action:   Check the certificate to determine whether it is valid. Obtain a new certificate,
               alert the sender that the certificate has failed, or resend.

1 Ответ

0 голосов
/ 20 февраля 2019

Ошибка кажется довольно понятной.Попробуйте googliing для UTL_SMTP, сертификата и 29024. 00000 - «Ошибка проверки сертификата» также прочитайте документы о том, как использовать этот пакет.Казалось бы, сбой сертификата безопасности.

Быстрый гугл появился this ,

Также, как новичок, помните, что вы просите нас не торопиться, чтобы помочь вам.Помогите нам, всегда указав версию продукта, какие шаги вы предприняли, какие результаты и какие поиски и исследования вы предприняли.

это может помочь: https://mathijsbruggink.com/2013/10/24/sending-mail-from-an-11g-oracle-database-utl_smtp/ https://community.oracle.com/thread/930797 http://www.dadbm.com/enable-oracle-database-to-send-emails-via-smtp-server/ https://community.oracle.com/thread/368259

https://community.oracle.com/thread/4089002 https://oracle -base.com / article / misc / utl_http-and-ssl

https://docs.oracle.com/database/121/ARPLS/u_smtp.htm#ARPLS074 https://oracle -base.com / article / misc / email-from-oracle-plsql

...