2016-11-17 4 views
0

필자는 오라클 리눅스에 포스트 픽스 서비스를 제공하고 있습니다. 내가 뭘 잘못했는지오라클 12c에서 오라클 리눅스 7의 후속 버전으로 이메일 보내기

ORA-29279: SMTP permanent error: 530 5.7.0 Must issue a STARTTLS command first. im3sm2477330wjb.13 - gsmtp /* 132/5 selected symbols */ 

또는 내가 무엇을 : 나는 내가 오류가 나는 기능을

BEGIN 
send_mail(msg_to  => '[email protected]', 
      msg_subject => 'Test subject', 
      msg_text => 'Test text'); 
END; 

을 실행할 때 나는 http://www.dba-oracle.com/t_utl_smtp_utility.htm

에서 발견 기능

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) := '[email protected]'; -- email of my company which hosted on Gmail 
    Mailhost varchar2(30) := 'smtp.gmail.com'; 

begin 
    c := Utl_Smtp.Open_Connection(Mailhost, 587); 
    Utl_Smtp.Helo(c, Mailhost); 
    Utl_Smtp.StartTLS(c); 
    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; 

에게 사용 해야만한다?

답변

1

오류는 how to secure the SMTP connection using SSL/TLS에 대한 설명서에 나와 있습니다. utl_smtp.starttls()으로 전화해야합니다.

... 
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); 
    ... 
+0

고맙습니다. @AlexPoole, 이제는 ORA-29279 : SMTP 영구 오류 : 503 5.5.1 EHLO/HELO first. r7sm3173844wjp.43 - gsmtp – a1b0r

+0

그래, 먼저 'ehlo' 콜을 해. 문서는 또한 나중에 사례를 통해 재발행해야한다고 말합니다. 문서에서 볼 수 있듯이'open_connection' 호출에 더 많은 인수를 제공해야 할 수도 있습니다. –

+0

문제의 코드를 다시 작성했는데 이제 PLS-00905 : SYS.SEND_MAIL 개체가 유효하지 않습니다./*; = # 59 */ – a1b0r