Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to send email using Oracle 10 g Forms

HmusmanJan 9 2016 — edited Jan 11 2016

i make a form i want when i click on button it send email i get a code for email from internet

    CREATE OR REPLACE FUNCTION FSC.SEND_MAIL

    (pIssuer IN VARCHAR2,

    pReceiver IN VARCHAR2,

    pSender IN VARCHAR2,

    pSubject IN VARCHAR2,

    pMessage IN VARCHAR2) RETURN VARCHAR2 IS

   

    c utl_smtp.connection;

    respuesta utl_smtp.reply;

    pServer VARCHAR2(50) := '192.168.0.6';

   

    BEGIN

   

    -- Open the connection to the mail server

    c := utl_smtp.open_connection(pServer);

    respuesta := utl_smtp.helo(c, pServer);

   

    -- Start the Issuer mail.

    respuesta := utl_smtp.mail(c, pSender);

   

    -- Starts Receiver

    respuesta := utl_smtp.rcpt(c, pReceiver);

   

    respuesta := utl_smtp.open_data(c);

    -- Enter the email header

    utl_smtp.write_data(c, 'From: ' || pIssuer || utl_tcp.CRLF);

    utl_smtp.write_data(c, 'To: ' || pReceiver || utl_tcp.CRLF);

    -- Enter the Subject

    utl_smtp.write_data(c, 'Subject: ' || pSubject || utl_tcp.CRLF);

    -- Write the message text.

    utl_smtp.write_data(c, utl_tcp.CRLF || pMessage);

    utl_smtp.write_data(c, utl_tcp.CRLF || '.');

   

    respuesta := utl_smtp.close_data(c);

   

    -- Close connection

    respuesta := utl_smtp.quit(c);

   

    RETURN '0';

   

    EXCEPTION

    WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN

    utl_smtp.quit(c);

    RETURN sqlerrm;

    --raise_application_error(-20000,

    -- 'The sending of the email has failed by returning the following error: ' || sqlerrm);

    WHEN OTHERS THEN

    RETURN sqlerrm;

    END;

    /

i make this function in sql it  and it was successfully run but when i execute then no email send to my desire address

    declare

   

    begin

   

    dbms_output.put_line(SEND_MAIL('usmanafb@ctm.com.pk','usmanafb@ctm.com.pk','usmanafb@ctm.com.pk','Testing','email message'));

    end;

i make a form i want when i click on button it send email i get a code for email from internet

        CREATE OR REPLACE FUNCTION FSC.SEND_MAIL

    (pIssuer IN VARCHAR2,

    pReceiver IN VARCHAR2,

    pSender IN VARCHAR2,

    pSubject IN VARCHAR2,

    pMessage IN VARCHAR2) RETURN VARCHAR2 IS

   

    c utl_smtp.connection;

    respuesta utl_smtp.reply;

    pServer VARCHAR2(50) := '192.168.0.6';

   

    BEGIN

   

    -- Open the connection to the mail server

    c := utl_smtp.open_connection(pServer);

    respuesta := utl_smtp.helo(c, pServer);

   

    -- Start the Issuer mail.

    respuesta := utl_smtp.mail(c, pSender);

   

    -- Starts Receiver

    respuesta := utl_smtp.rcpt(c, pReceiver);

   

    respuesta := utl_smtp.open_data(c);

    -- Enter the email header

    utl_smtp.write_data(c, 'From: ' || pIssuer || utl_tcp.CRLF);

    utl_smtp.write_data(c, 'To: ' || pReceiver || utl_tcp.CRLF);

    -- Enter the Subject

    utl_smtp.write_data(c, 'Subject: ' || pSubject || utl_tcp.CRLF);

    -- Write the message text.

    utl_smtp.write_data(c, utl_tcp.CRLF || pMessage);

    utl_smtp.write_data(c, utl_tcp.CRLF || '.');

   

    respuesta := utl_smtp.close_data(c);

   

    -- Close connection

    respuesta := utl_smtp.quit(c);

   

    RETURN '0';

   

    EXCEPTION

    WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN

    utl_smtp.quit(c);

    RETURN sqlerrm;

    --raise_application_error(-20000,

    -- 'The sending of the email has failed by returning the following error: ' || sqlerrm);

    WHEN OTHERS THEN

    RETURN sqlerrm;

    END;

    /

i make this function in sql it  and it was successfully run but when i execute then no email send to my desire address

    declare

   

    begin

   

    dbms_output.put_line(SEND_MAIL('usmanafb@ctm.com.pk','usmanafb@ctm.com.pk','usmanafb@ctm.com.pk','Testing','email message'));

    end;

i use my local exchange for eamil sending  and the ip address of that server is 192.168.0.6

the second issue in this code when i make same function in Oracle 10 g forms then it give me this error

utl_tcp.CRLF is can not directly acces remote package

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Feb 8 2016
Added on Jan 9 2016
6 comments
1,723 views