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

Sunil Bhatia

Hi,

Onload text item would be null if your code runs before populating the actual apex item. Why dont you try the same code on button click.

It will ensure the syntax you are using is correct or not. Also if you are using oracle workspace, share the link of application as well.

-- Sunil Bhatia

Ap3x DEV

i have created a dynamic action on button but when i click it does not fires

work space name persnal

user name test

password is 1234gee

app name is ebay u can chake it out thnx

nad page number is 5 title is reporting2

Tom Petrus

javascript is case sensitive. Item IDs are generated in uppercase.

$v('P1_VALUE')

Sunil Bhatia

Your page has 3 errors in javascript console. Correct them and then execute your javascript, it will probably run.

[blocked] The page at 'https://apex.oracle.com/pls/apex/f?p=56420:5:116547887824068:::::' was loaded over HTTPS, but ran insecure content from 'http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findI…IN&itemFilter(2).value(1)=FixedPrice&itemFilter(2).value(2)=StoreInventory': this content should also be loaded over HTTPS.  f?p=56420:5:116547887824068::::::1

Uncaught SyntaxError: Unexpected token < f?p=56420:5:116547887824068::::::210

Uncaught TypeError: undefined is not a function



Ap3x DEV

hi tom thnx for reply and

i have done that but it still not working

Ap3x DEV

hi sunil thnx for help but i am trying to create a page in apex that will get the data from ebay

and show it in my apex page in my js code i m actually calling the ebay api and getting the data from it and displaying it in my

html region div

<html>

<head>

<title>ebay data</title>

<body>

<h1>eBay Search Results</h1>

<div id="results"></div>

<script>

// Parse the response and build an HTML table to display search results

function _cb_findItemsByKeywords(root) {

  var items = root.findItemsByKeywordsResponse[0].searchResult[0].item || [];

  var html = [];

  html.push('<table width="100%" border="0" cellspacing="0" cellpadding="3"><tbody>');

  for (var i = 0; i < items.length; ++i) {

    var item     = items[i];

    var title    = item.title;

    var pic      = item.galleryURL;

    var viewitem = item.viewItemURL;

    if (null != title && null != viewitem) {

      html.push('<tr><td>' + '<img src="' + pic + '" border="0">' + '</td>' +

      '<td><a href="' + viewitem + '" target="_blank">' + title + '</a></td></tr>');

    }

  }

  html.push('</tbody></table>');

  document.getElementById("results").innerHTML = html.join("");

}  // End _cb_findItemsByKeywords() function

// Create a JavaScript array of the item filters you want to use in your request

var filterarray = [

  {"name":"MaxPrice",

   "value":"25",

   "paramName":"Currency",

   "paramValue":"USD"},

  {"name":"FreeShippingOnly",

   "value":"true",

   "paramName":"",

   "paramValue":""},

  {"name":"ListingType",

   "value":["AuctionWithBIN", "FixedPrice", "StoreInventory"],

   "paramName":"",

   "paramValue":""},

  ];

// Define global variable for the URL filter

var urlfilter = "";

// Generates an indexed URL snippet from the array of item filters

function  buildURLArray() {

  // Iterate through each filter in the array

  for(var i=0; i<filterarray.length; i++) {

    //Index each item filter in filterarray

    var itemfilter = filterarray[i];

    // Iterate through each parameter in each item filter

    for(var index in itemfilter) {

      // Check to see if the paramter has a value (some don't)

      if (itemfilter[index] !== "") {

        if (itemfilter[index] instanceof Array) {

          for(var r=0; r<itemfilter[index].length; r++) {

          var value = itemfilter[index][r];

          urlfilter += "&itemFilter\(" + i + "\)." + index + "\(" + r + "\)=" + value ;

          }

        }

        else {

          urlfilter += "&itemFilter\(" + i + "\)." + index + "=" + itemfilter[index];

        }

      }

    }

  }

}  // End buildURLArray() function

// Execute the function to build the URL filter

buildURLArray(filterarray);

// Construct the request

// Replace MyAppID with your Production AppID

var keywe = "&keywords=query";

window.alert($v('P5_VALUR'));

var url = "http://svcs.ebay.com/services/search/FindingService/v1";

    url += "?OPERATION-NAME=findItemsByKeywords";

    url += "&SERVICE-VERSION=1.0.0";

    url += "&SECURITY-APPNAME=WizmenSy-c510-435d-9924-1f1b5e68bb03";

    url += "&GLOBAL-ID=EBAY-US";

    url += "&RESPONSE-DATA-FORMAT=JSON";

    url += "&callback=_cb_findItemsByKeywords";

    url += "&REST-PAYLOAD";

    url +=  keywe;

    url += "&paginationInput.entriesPerPage=3";

    url += urlfilter;

// Submit the request

s=document.createElement('script'); // create script element

s.src= url;

document.body.appendChild(s);

</script>

</body>

</html>

this is the code i m actualy executing

i m using ebay function find items by keywords and input field i m creating so that user can enter the keywords

and ebay will return the result

now tel me wht should i do????

1 - 6
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,724 views