Function UTL_SMTP

Dicas do Oracle Forms Builder - Blocos, Itens, LOV, Canvas, Triggers, comandos, PLL, d2kwutil, FMB, Alert, menus, etc
  

Poston Mon, 27 Jun 2005 5:58 pm

Personal speaks ... td right? I hope so ...

I'm new here, as everyone can see:P so I'm having a little problem when trying to use the function UTL_SMTP which is used for sending e-mails ... when trying to send the same message to multiple recipients the FORMS presents an error..

I wonder if someone could give me a force ... grateful attention each of you ... later view and strong hug to all ...
Deathão
Location: Assis

--
Júnior

Poston Mon, 27 Jun 2005 6:00 pm

Hello Deathão Shows aí as you're doing!!!

:-o
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered

Poston Tue, 28 Jun 2005 9:09 am

Click the button:
Code: Select all
DECLARE
   SMTP_EMAIL varchar2(100);
   remetente varchar2(300);
BEGIN
   IF :envia_email.txt_destinatario IS NULL OR :envia_email.txt_assunto IS NULL OR :envia_email.txt_mensagem IS NULL THEN
      message ('Todos os Campos devem ser Preenchidos');
      message ('Todos os Campos devem ser Preenchidos');
      raise form_trigger_failure;
   ELSE
      remetente := 'junior@sgq.com.br';
     --SMTP_EMAIL := 'smtp.femanet.com.br';
      SELECT SMTP
      INTO SMTP_EMAIL
      FROM email
      WHERE smtp = 'smtp.femanet.com.br';
      envia_mail(SMTP_EMAIL,
                     remetente,
                     :envia_email.txt_destinatario,
                     :envia_email.txt_assunto,
                     :envia_email.txt_mensagem);
      :envia_email.txt_destinatario := null;
      :envia_email.txt_assunto := null;
      :envia_email.txt_mensagem := null;
   END IF;
END;
: Function
Code: Select all
PROCEDURE envia_mail(p_mailhost  IN VARCHAR2,
                     p_sender    IN VARCHAR2,
                     p_recipient IN VARCHAR2,
                     p_subject   IN VARCHAR2,
                     p_message   IN VARCHAR2 ) IS

       mail_conn UTL_SMTP.CONNECTION;

       crlf VARCHAR2( 2 ) := CHR( 13 ) || CHR( 10 );
       mesg VARCHAR2( 5000 );
BEGIN
  mail_conn := UTL_SMTP.OPEN_CONNECTION( p_mailhost, 25 );
  mesg:= 'Date: ' || TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || crlf ||
         'From: <' || p_sender || '>' || crlf ||
         'Subject: ' || p_subject || crlf ||
         'To: ' || p_recipient  || crlf || ''  || crlf ||  p_message;
  UTL_SMTP.HELO( mail_conn, p_mailhost );
  UTL_SMTP.MAIL( mail_conn, p_sender );
  UTL_SMTP.RCPT( mail_conn, p_recipient);
  UTL_SMTP.DATA( mail_conn, mesg );
  UTL_SMTP.QUIT( mail_conn );
END;
to an email it works baby, but when I put in more than one sender text_field separated by \";\" he gives an error on FORMS ... thanks thanks for the strength.
Deathão
Location: Assis

--
Júnior

Poston Tue, 28 Jun 2005 9:28 am

That's because the UTL_SMTP does not support sending more than one email at a time.

I think you will have to do a routine where you divide the string of the recipient. Something like this: If you have 2 emails separated by; He seprara each of them and sends them one by one ...

Another thing you can do is treat the exceptions: UTL_SMTP.INVALID_OPERATION UTL_SMTP.TRANSIENT_ERROR UTL_SMTP. PERMANENT_ERROR:-
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered

Poston Tue, 28 Jun 2005 9:40 am

VIX!!!!!! but aí will be \"DU BOZO\" the shit huh!!!! :-have as you give me a hint how to do this??

thanks ...


These exptions treatments do what?

Thanks again DrGori.

by the way you enjoy a Heavy huh ...:-the simpleton here won't stop shaking your head. hahah thanks!!!!!
Deathão
Location: Assis

--
Júnior

Poston Tue, 28 Jun 2005 4:13 pm

There's no way I put a field like Cc (With copy)?


Thanks
Deathão
Location: Assis

--
Júnior

Poston Tue, 28 Jun 2005 4:53 pm

Do a search on the forum!!!
Look what I found: viewtopic.php?t=207&highlight=%2Amail%2A About the exceptions, you can capture the error when it gives.
Examples: ORA-29279: SMTP permanent error: 501 5.5.4 Invalid Address ORA-29279: SMTP permanent error: 550 5.7.1 Unable to relay for mymail@gmail.com ORA-29278: SMTP transient error: 421 Service not available
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered


  • See also
    Replies
    Views
    Last Post


      Return to Forms

      Who is online

      Users browsing this forum: No registered users and 6 guests