7 Replies Latest reply: Feb 13, 2013 6:48 AM by Christian Erlinger RSS

    unable to send mail to gmail

    967903
      hello experts,
      i am using oracle 10g(10.2.0.1).
      i m facing problem when i send mail to gmail through my oracle database server.

      i am using following code.
      when i run this code on toad then mail are not deliver to gmail.
      declare
      v_From VARCHAR2(80):='My Name "<ravi.master2@gmail.com>"';
      v_Recipient varchar2(80) := 'ravi.master2@gmail.com';
      v_Recipient1 varchar2(80) := 'ravi.erp@iljin.co.in';
      v_Subject varchar2(80) := 'PO Approval';
      v_Mail_Host varchar2(80) := 'smtp.gmail.com';
      v_Mail_Conn utl_smtp.Connection;
      crlf VARCHAR2(2) := chr(13)||chr(10);
      smtp_tcpip_port constant pls_integer:=587;
      begin
      --smtp_tcpip_port :=26;
      v_Mail_Conn := utl_smtp.Open_Connection(v_mail_host,587);
      utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
      utl_smtp.Mail(v_Mail_Conn, v_From);
      utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
      utl_smtp.Rcpt(v_Mail_Conn, v_Recipient1);
      utl_smtp.Data(v_Mail_Conn,
      'Date: ' || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf ||
      'From: ' || v_From || crlf ||
      'Subject: '|| v_Subject || crlf ||
      'To: ' || v_Recipient || crlf ||
      crlf ||
      'Dear Sir,'||crlf ||
      'You Recieved PO No for Approval'|| crlf
      --||'more message text'|| crlf
      );
      utl_smtp.Quit(v_mail_conn);


      EXCEPTION
      WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
      --mess('Unable to send mail: '||sqlerrm);
      --raise form_trigger_failure;*/
      DBMS_OUTPUT.PUT_LINE('HELLO');
      end;


      when i use my local ip as a host then mail sending but when i changed my host as smtp.google.com and port as 587 then error occured


      Thanks
      Ravi