1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Send Mail from UCM form

Discussion in 'Oracle Webcenter Suite (formerly Oracle ECM)' started by sandeepg, Jun 19, 2009.

  1. sandeepg

    sandeepg Active Member

    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    55
    Hi,

    We are using 10gR3. We have a requirement to capture the form data and send a mail to SMTP server.

    Is there any plugin available in 10gR3 to do the same or if there is any ready made code snippet available for the same.

    Regards,
    Sandeep
     
  2. Sadik

    Sadik Community Moderator Forum Guru

    Messages:
    1,906
    Likes Received:
    252
    Trophy Points:
    1,455
    How are you capturing the data? I mean When you say Form data what exactly do you mean. Is it a HCSF or JSP or any other form?
     
  3. sandeepg

    sandeepg Active Member

    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    55
    Its a HSCP form. We have created a separate fragment for the form.
     
  4. sas_sas3000

    sas_sas3000 Active Member

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    55
    you can store this procedure on your data base:


    create or replace PROCEDURE send_mail
    ( sender IN VARCHAR2,
    recipient IN VARCHAR2,
    subject IN VARCHAR2,
    message IN VARCHAR2)
    IS
    mailhost VARCHAR2(30) := 'ppp.ppp.ppp.ppp'; #IP for Internal Mail or MailHost Name
    webhost VARCHAR2(30) := 'eee.eee.eee.eee'; #IP for External Mail
    mail_conn utl_smtp.connection;
    crlf VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );
    mesg VARCHAR2( 1000 );
    BEGIN
    mail_conn := utl_smtp.open_connection(mailhost, 25);
    mesg:= 'Date: ' || TO_CHAR( SYSDATE, 'dd-MM-YYYY hh24:mi:ss' ) || crlf
    ||
    'From: <'||sender||'>' || crlf ||
    'Subject: '||subject || crlf ||
    'To: '||recipient || crlf ||
    'A Request Have been saved
    The output can be viewed below. '||crlf||
    ' '||crlf|| message;
    utl_smtp.helo(mail_conn, mailhost);
    utl_smtp.mail(mail_conn, sender);
    utl_smtp.rcpt(mail_conn, recipient);
    utl_smtp.data(mail_conn, mesg);
    utl_smtp.quit(mail_conn);
    Exception
    WHEN OTHERS THEN

    raise_application_error(-20002,'unable to send the mail.'||SQLERRM);
    END;

    Call this to send E-mail via the following procedure

    begin
    send_mail('Sender_email ',V_Mail,'Subject',V_Subject);
    Exception
    WHEN OTHERS THEN
    send_message ('-20002'||'unable to send the mail.'||SQLERRM);
    then you can call it to send mail as the following call: