Sending e-mails in Oracle 10g

Hello, all
I have a query that returns on average ~150 rows. I want to set up a job to spool the query's results to a .txt or .csv file and then e-mail it as an attachment.
I am using the sys.utl_mail package to send other query results, however when attempting to use it for this particular query it is failing - presumably due to the 32k size restriction.
Has anyone ran a query returning a number of rows then distributed it via an e-mail attachment? What's the best way to go?
Edited by: user12144603 on Jul 9, 2010 8:12 PM

I perhaps should have clarified: I am looking for a way to put query results in an attachment and send them via e-mail. Given certain solutions' limitations I was seeking best practices for doing this. My attachments will certainly exceed the 32k limit of some options.
I decided on the mail_demo package available here: http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/maildemo_sql.txt.
There was a terrific post regarding its use here: Re: Send Email with Attachement more than 32K I took the code sample from hoek and plugged my own values in where appropriate.
I am able to populate a .csv with my query results and have it e-mailed it successfully in a .csv (Yay!), however there are two problems:
1. whereas the query returns 150 rows on its own the .csv in my Inbox has 11,325 rows.
2. I would like to put a delimiter between the columns, so the output is more legible
If something jumps out at anyone please advise. Thanks in advance for any assistance.
DECLARE
lv_sender VARCHAR2(200) := '[email protected]';
lv_recipients VARCHAR2(200) := '[email protected]';
lv_subject VARCHAR2(200) := 'Attachment Test';
lv_priority PLS_INTEGER := NULL;
lv_last BOOLEAN := FALSE;
lv_count NUMBER := 0;
lv_message VARCHAR2(32000);
lv_conn utl_smtp.connection;
CURSOR cur_query
IS
select Mycolumn a, Mycolumn2 b, Mycolumn3 c, Mycolumn4 d, Mycolumn5 e, Mycolumn6 f, Mycolumn7 g, Mycolumn8 h, Mycolumn9 i, Mycolumn10 j, Mycolumn11 k, Mycolumn12 l,
Mycolumn13 m, Mycolumn14 n, Mycolumn15 o, Mycolumn16 p, Mycolumn17 q, Mycolumn18 r, Mycolumn19 s, Mycolumn20 t, Mycolumn21 u, Mycolumn v
from
MyTable;
BEGIN
lv_conn:= demo_mail.begin_mail
( lv_sender
, lv_recipients
, lv_subject
, demo_mail.multipart_mime_type
, lv_priority
demo_mail.begin_attachment
( lv_conn
,'text/html'
,FALSE -- Means its not inline
,'test.csv'
,'7 bit'
FOR rec IN cur_query
LOOP
lv_message := lv_message||rec.a||rec.b||rec.c||rec.d||rec.e||rec.f||rec.g||rec.h||rec.i||rec.j||rec.k||rec.l||rec.m||rec.n||rec.o||rec.p||rec.q||rec.r||rec.s||rec.t||rec.u||rec.v||chr(13);
demo_mail.write_text( lv_conn,lv_message);
END LOOP;
demo_mail.end_attachment
( lv_conn
,TRUE
demo_mail.end_mail(lv_conn) ;
END;
Edited by: user12144603 on Jul 10, 2010 10:34 AM

Similar Messages

  • Scheduling a job to send e-mails in Oracle 10g

    Hi,
    Our application has a scheduled job that runs every hour to fetch data from another application. The SP which this job calls has logic to send e-mails at various stages of the job execution about the status of the job execution. Sometimes, the e-mails are failing due to an SMTP transient error on the server, and thus the job hangs in the RUNNING state.
    We were asked to bypass sending the e-mails, and implement that as a separate job. But the problem is that the e-mails are triggered based on some conditions during the main job's execution. So, how is it possible that I can implement just the e-mail thing as a separate job.
    Our main job is like below....
    1) Job starts -> Send e-mail#1 that the feed started
    2) Extract completed and some tables updated-> Send e-mail#2
    3) Load to few other tables happened
    4) Final Merge to production tables completed -> Send email#3 that the feed is over.
    Now, since email #1,2,3 are based on conditional check, how feasible is it to implement these are separate jobs?
    Is there any other way that runs the main job even though sending e-mails gets stuck somewhere?
    Any help is highly appreciated.
    Regards,
    Ranganath

    Hi,
    Can I do something like below. My main job calls a procedure (PRC_SEND_NOTIFICATION) which takes 4 parameters and sends out the e-mails. Now I'm trying to implement sending out the e-mails as a separate job.
    -- Run the below Procedure in place of PRC_SEND_NOTIFICATION in the main job.
    PRC_EMAIL_JOB ('PRC_SEND_NOTIFICATION (param1,param2,param3,param4)' );
    -- Inside the PRC_EMAIL_JOB SP submit the procedure as a job
    CREATE OR REPLACE PROCEDURE PRC_EMAIL_JOB (PROC_NAME IN VARCHAR2)
    IS
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
    job_name => 'Send Email',
    job_type => 'STORED_PROCEDURE',
    job_action =>PROC_NAME || ';', -- What to run
    start_date => SYSDATE, -- Start right away
    repeat_interval => NULL ,-- Run only once
    comments => 'Send an email',
    enabled => TRUE
    COMMIT;
    END;
    Does this new job get dropped as soon as it finishes (as the repeat interval is NULL). So when the main job runs again, this new job gets created again and runs. This is my understanding. Correct me if I'm wrong. Any help is highly appreciated.
    Regards,
    Ranganath

  • Send table data through mail in oracle 10g

    Hi ,
    I am trying to send a mail through oracle 10g .
    I can send mail through utl_mail .
    The text that I need to send is data from a table .
    The table contains information about all the employees .
    Table name is person . If the employee is absent on any day without any reason there would be a row of this employee in the table person.
    There is also a column named email in this table .
    I need to write a stored procedure which will send the data about each particular employee to their respective email for all the employees in the person table .
    Can anyone please help me on this .
    Thank you.

    Try this forum thread first:
    Re: send email by procedure
    There are lots of articles on how to accomplish this taks on the web:
    -- utl_smtp example
    http://it.toolbox.com/wiki/index.php/Send_email_from_Oracle_Database
    http://www.databasejournal.com/features/oracle/article.php/3423431/Sending-e-mail-from-within-Oracle.htm
    -- From Application Express product
    http://www.oracle.com/technology/products/database/application_express/howtos/howto_workflow.html
    HTH -- Mark D Powell --

  • How to Send mail in oracle 10g

    I am new in oracle developer.....we are using oracle 10g developer...how to send mail through oracle 10g on a button click.pease help me.
    Thanks in advance

    This question have been asked many times on this forum, see if you get help from following:
    https://forums.oracle.com/message/5395438#5395438
    Search results: https://forums.oracle.com/thread/search.jspa?peopleEnabled=true&userID=&containerType=&container=&q=form+email
    Check this out as well:
    http://nzchaudhry.wordpress.com/2013/05/31/send-report-via-email-attachment-in-oracle-forms-10g/
    You can find init.ora or initSID.ora file under $ORACLE_HOME/dbs on linux and on Windows under $ORACLE_HOME/database. Otherwise you can create it using "create pfile from spfile" command
    Aneel

  • Sending a mail from oracle database

    Hi,
    I have a requirement to send a mail from oracle database.I use UTL_TCP package for this.Although my procedure is executed successfully,i dont get the mails in my inbox.Please help me to figure out a solution.
    Thanks in advance....

    Hi, you must use UTL_SMTP package for send emails, it has more performance and features for debug. You must look the next code, this is a example for send emails.
    DECLARE
    c UTL_SMTP.CONNECTION;
    PROCEDURE send_header(name IN VARCHAR2, header IN VARCHAR2) AS
    BEGIN
    UTL_SMTP.WRITE_DATA(c, name || ': ' || header || UTL_TCP.CRLF);
    END;
    BEGIN
    c := UTL_SMTP.OPEN_CONNECTION('smtp-server.acme.com');
    UTL_SMTP.HELO(c, 'foo.com');
    UTL_SMTP.MAIL(c, '[email protected]');
    UTL_SMTP.RCPT(c, '[email protected]');
    UTL_SMTP.OPEN_DATA(c);
    send_header('From', '"Sender" <[email protected]>');
    send_header('To', '"Recipient" <[email protected]>');
    send_header('Subject', 'Hello');
    UTL_SMTP.WRITE_DATA(c, UTL_TCP.CRLF || 'Hello, world!');
    UTL_SMTP.CLOSE_DATA(c);
    UTL_SMTP.QUIT(c);
    EXCEPTION
    WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
    BEGIN
    UTL_SMTP.QUIT(c);
    EXCEPTION
    WHEN UTL_SMTP.TRANSIENT_ERROR OR UTL_SMTP.PERMANENT_ERROR THEN
    NULL; -- When the SMTP server is down or unavailable, we don't have
    -- a connection to the server. The QUIT call will raise an
    -- exception that we can ignore.
    END;
    raise_application_error(-20000,
    'Failed to send mail due to the following error: ' || sqlerrm);
    END;
    Also review the next link for get more information about the UTL_SMTP packege.
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_smtp.htm#sthref15587
    Regards.

  • How to send a mail thru Oracle

    Hello Every one ,
    Can u plz tell me the way to send a mail thru oracle...................

    Follow the below steps..........
    INTRODUCTION:
    This bulletin explains how to programmatically send a fax/email message from a
    Forms/Reports application via Microsoft Exchange without any kind of user
    interaction. It shows the general usage of the 'Mail' package as well as a fully
    coded Forms sample application.
    The concept of OLE (Object Linking and Embedding) automation is used to control
    the OLE server application (Microsoft Exchange) using the client application.
    The client in this case may be a Developer/2000 Forms or Reports application. It
    uses the objects and methods exposed by the OLE Messaging Library which are
    much more robust than the MSMAPI OCX controls and allow access to many more MAPI
    properties.
    Oracle provides support for OLE automation in its applications by means of the
    OLE2 built-in package. This package contains object types and built-ins for
    creating and manipulating the OLE objects. Some of these built-ins for e.g.
    OLE2.create_obj, OLE2.invoke, OLE2.set_property have been extensively used in
    the code.
    GENERAL USAGE:
    The Mail package contains three procedures:
    1. Procedure Mail_pkg.logon( profile IN varchar2 default NULL);
    Use this procedure to logon to the MS Exchange mail client. The procedure
    takes a character argument which specifies the Exchange Profile to use for
    logon. Passing a NULL argument to the logon procedure brings up a dialog box
    which asks you to choose a profile from a list of valid profiles or create a new
    one if it doesn't exist.
    2. Procedure Mail_pkg.send(
    --------- Recipient IN varchar2,
    Subject IN varchar2 default NULL,
    Text IN varchar2 default NULL,
    Attachment IN varchar2 default NULL
    This is the procedure that actually sends the message and attachments, if
    any, to the recipient. The recipient may be specified directly as a valid email
    address or as an alias defined in the address book. If the message is intended
    for a fax recipient then a valid alias must be used that is defined as a fax
    address in the address book.
    3. Procedure Mail_pkg.logoff;
    This procedure closes the Exchange session and deallocates the resources used
    by the OLE automation objects.
    SAMPLE FORMS APPLICATION:
    1. Create the Mail Package using the following two Program Units:
    (a) Mail Package Spec
    (b) Mail Package Body
    Mail Package Spec:
    PACKAGE Mail_pkg IS
    session OLE2.OBJ_TYPE; /* OLE object handle */
    args OLE2.LIST_TYPE; /* handle to OLE argument list */
    procedure logon( Profile IN varchar2 default NULL );
    procedure logoff;
    procedure send( Recp IN varchar2,
    Subject IN varchar2,
    Text IN varchar2,
    Attch IN varchar2
    END;
    Mail Package Body:
    PACKAGE BODY Mail_pkg IS
    session_outbox OLE2.OBJ_TYPE;
    session_outbox_messages OLE2.OBJ_TYPE;
    message1 OLE2.OBJ_TYPE;
    msg_recp OLE2.OBJ_TYPE;
    recipient OLE2.OBJ_TYPE;
    msg_attch OLE2.OBJ_TYPE;
    attachment OLE2.OBJ_TYPE;
    procedure logon( Profile IN varchar2 default NULL )is
    Begin
    session := ole2.create_obj('mapi.session');
    /* create the session object */
    args := ole2.create_arglist;
    ole2.add_arg(args,Profile);/* Specify a valid profile name */
    ole2.invoke(session,'Logon',args);
    /* to avoid the logon dialog box */
    ole2.destroy_arglist(args);
    End;
    procedure logoff is
    Begin
    ole2.invoke(session,'Logoff');
    /* Logoff the session and deallocate the */
    /* resources for all the OLE objects */
    ole2.release_obj(session);
    ole2.release_obj(session_outbox);
    ole2.release_obj(session_outbox_messages);
    ole2.release_obj(message1);
    ole2.release_obj(msg_recp);
    ole2.release_obj(recipient);
    ole2.release_obj(msg_attch);
    ole2.release_obj(attachment);
    End;
    procedure send( Recp IN varchar2,
    Subject IN varchar2,
    Text IN varchar2,
    Attch IN varchar2
    )is
    Begin
    /* Add a new object message1 to the outbox */
    session_outbox := ole2.get_obj_property(session,'outbox');
    session_outbox_messages := ole2.get_obj_property(session_outbox,'messages');
    message1 := ole2.invoke_obj(session_outbox_messages,'Add');
    ole2.set_property(message1,'subject',Subject);
    ole2.set_property(message1,'text',Text);
    /* Add a recipient object to the message1.Recipients collection */
    msg_recp := ole2.get_obj_property(message1,'Recipients');
    recipient := ole2.invoke_obj(msg_recp,'add') ;
    ole2.set_property(recipient,'name',Recp);
    ole2.set_property(recipient,'type',1);
    ole2.invoke(recipient,'resolve');
    /* Add an attachment object to the message1.Attachments collection */
    msg_attch := ole2.get_obj_property(message1,'Attachments');
    attachment := ole2.invoke_obj(msg_attch,'add') ;
    ole2.set_property(attachment,'name',Attch);
    ole2.set_property(attachment,'position',0);
    ole2.set_property(attachment,'type',1); /* 1 => MAPI File Data */
    ole2.set_property(attachment,'source',Attch);
    /* Read the attachment from the file */
    args := ole2.create_arglist;
    ole2.add_arg(args,Attch);
    ole2.invoke(attachment,'ReadFromFile',args);
    ole2.destroy_arglist(args);
    args := ole2.create_arglist;
    ole2.add_arg(args,1); /* 1 => save copy */
    ole2.add_arg(args,0); /* 0 => no dialog */
    /* Send the message without any dialog box, saving a copy in the Outbox */
    ole2.invoke(message1,'Send',args);
    ole2.destroy_arglist(args);
    message('Message successfully sent');
    End;
    END;
    2. Create a block called MAPIOLE with the following canvas layout:
    |-------------------------------------------------------------|
    | |
    | Exchange Profile: |====================| |
    | |
    | To: |============================| |
    | |
    | Subject: |============================| |
    | |
    | Message: |============================| |
    | | | |
    | | | |
    | | | |
    | | | |
    | | | |
    | |============================| |
    | |-----| |
    | Attachment: |============================| |SEND | |
    | |-----| |
    |-------------------------------------------------------------|
    The layout contains 5 text-itmes:
    - Profile
    - To
    - Subject
    - Message (multiline functional property set to true)
    - Attach
    and a 'Send' button with the following WHEN-BUTTON-PRESSED trigger:
    mail_pkg.logon(:profile);
    mail_pkg.send(:to,:subject,:message,:attch);
    mail_pkg.logoff;

  • Send bulk mail in oracle apps 11i with pdf/Xls attachment

    hi,
    I have a task how can i send bulk emails in one go ( aprrox 150-200 emails in one go) in oaracle apps 11 with attachment pdf/xls
    thanks

    Duplicate post.
    how to send bulk mail in oracle apps 11i with pdf/Xls attachment
    Re: how to send bulk mail in oracle apps 11i with pdf/Xls attachment

  • ORA-29279: SMTP permanent error: To Send Mail from Oracle 10g (10.2.0.1)

    I have installed Oracle 10g (10.2.0.1) on Windows XP (SP2) machine at my home PC.There is a broadband connection on my home PC.I have installed UTL_MAIL package and then set SMTP_OUT_PARAMETER by the following SQL Statement.
    My machine IP address is 192.168.0.3
    SQl> alter system set smtp_out_server = 'smtp.bsnl.in:25' scope = 25;
    Then we run the following script.
    BEGIN
    UTL_MAIL.SEND(
    SENDER => '[email protected]',
    RECIPIENTS => '[email protected]',
    SUBJECT => 'Testing UTL_MAIL',
    MESSAGE => 'The receipt of this email means'||
    'that it works for UTL_MAIL'
    END;
    Then following error message comes.
    BEGIN
    ERROR at line 1:
    ORA-29279: SMTP permanent error: 553 Authentication is required to send mail as
    <[email protected]>
    ORA-06512: at "SYS.UTL_SMTP", line 21
    ORA-06512: at "SYS.UTL_SMTP", line 99
    ORA-06512: at "SYS.UTL_SMTP", line 222
    ORA-06512: at "SYS.UTL_MAIL", line 407
    ORA-06512: at "SYS.UTL_MAIL", line 594
    ORA-06512: at line 2
    Can anybody suggest the solution of the above problem.

    Hi,
    is your smtp server configured to use anonymous connection?
    Attackwave
    Reply Code       Description
    211      System status, or system help reply
    214      Help message [Information on how to use the receiver or the meaning of a particular non-standard command; this reply is useful only to the human user]
    220      <domain> Service ready
    221      <domain> Service closing transmission channel
    250      Requested mail action okay, completed
    251      User not local; will forward to <forward-path>
    252      OK, pending messages for node <node> started. Cannot VRFY user (for example, info is not local), but will take message for this user and attempt delivery.
    253      OK, <messages> pending messages for node <node> started
    354      Start mail input; end with <CRLF>.<CRLF>
    355      Octet-offset is the transaction offset
    421      <domain> Service not available, closing transmission channel (This may be a reply to any command if the service knows it must shut down.)
    450      Requested mail action not taken: mailbox unavailable [for example, mailbox busy]
    451      Requested action terminated: local error in processing
    452      Requested action not taken: insufficient system storage
    453      You have no mail.
    454      TLS not available due to temporary reason. Encryption required for requested authentication mechanism.
    458      Unable to queue messages for node <node>
    459      Node <node> not allowed: reason
    500      Syntax error, command unrecognized (This may include errors such as command line too long.)
    501      Syntax error in parameters or arguments
    502      Command not implemented
    503      Bad sequence of commands
    504      Command parameter not implemented
    521      <Machine> does not accept mail.
    530      Must issue a STARTTLS command first. Encryption required for requested authentication.
    534      Authentication mechanism is too weak.
    538      Encryption required for requested authentication mechanism.
    550      Requested action not taken: mailbox unavailable [for , mailbox not found, no access]
    551      User not local; please try <forward-path>
    552      Requested mail action terminated: exceeded storage allocation
    *553      Requested action not taken: mailbox name not allowed [for example, mailbox syntax incorrect]*
    554      Transaction failed

  • Can anybody send me ebook for 'oracle 10g programming with pl/sql'

    Hi
    can any one send me ebook for oracle's 'oracle 10g programming with pl/sql', 'java'
    My mail id is: [email protected]
    Thanking in advance.

    I hope it can guide you to get ebooks for your request.
    http://www.oracle.com/technology/tech/pl_sql/index.html
    Cheers
    Vigneswaran

  • How a send a mail from  Oracle   ----- urgent

    Hi,
    I am working in oracle9i and linux 2.4. i need to a send mail from oracle .Please send the procedure to me in a detail manner.
    I am having one procedure .plz check and change if possible...
    declare
    l_maicon utl_smtp.connection;
    begin
    l_maicon :=utl_smtp.open_connection('mail.com');
    utl_smtp.helo(l_maicon,'mail.com');
    utl_smtp.mail(l_maicon,'[email protected]');
    utl_smtp.rcpt(l_maicon,'[email protected]');
    utl_smtp.data(l_maicon,'From: [email protected]' || utl_tcp.crlf||
    'To: [email protected]' || utl_tcp.crlf ||
    'Subject: database e-mail option' || utl_tcp.crlf ||
    'You have received this mail from database!');
    utl_smtp.quit(l_maicon);
    end;
    Please explain me in detail
    Gobi....

    If I do a Google search on the terms "Oracle mail", this askTom thread is the second hit
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:255615160805
    Did you already find this thread? If so, did it not answer your question sufficiently?
    Additionally, it would be quite helpful if you would post the results of running the code you posted. You've given no indication whether there is an error, what error might be generated, whether you're not seeing the expected behavior, whether the code crashes your system, etc. That leaves us to guess about what problems you might have between syntax errors, permission problems, configuration problems on the database, configuration problems on the SMTP server, operating system problems, network problems (the list goes on).
    Justin

  • Send e-mail from Oracle 9i (9.2.0.1)

    Hi,
    Iam using oracle 9iR2(9.2.0.1) on Widows XP Platform. I want to send mail thru oracle 9i(9.2.0.1) database.
    for that i got a procedure from net. Also they asked to follow three steps. the steps are
    1. Execute the script as sys "D:\Oracle\Ora92\javavm\install\initjvm.sql"
    2. Execute the loadjava classfile as
    D:\Oracle\Ora92\plsql\jlib>loadjava -f -v -r -u sys/**** plsql.jar
    3. Execute the script as sys "$ORACLE_HOME\rdbms\admin\initplsj.sql"
    I sucessfully executed the first step, but for the second step i am not able to locate the plsql.jar file in the specified path.
    So Please tell me if there is any other method to perform this task
    Regards
    Prasanta Pramanik.

    Is there some reason not to use the built-in UTL_SMTP package?
    http://www.psoug.org/reference/utl_smtp.html
    It has been available since 8.1.7.

  • Sending e-mail through oracle form.

    Hi Guys,
    I am using forms6i to develop forms and have deploy them on web using 9iAS.
    Now in one of my form, i need to send the information on that form to a couple of people through e-mail.
    what is the easiest and the best way to send e-mail?
    Can i use any built-in package of oracle on web?
    If someone can help through code, it will be appriciated as i really have no idea how to do it.
    I just want to add a send button on my form... and the formatted inofrmation will be send on a couple of e-mail address.
    Please help me,
    Imran

    You could send it from the database (depending on what version you are running against), check out the UTL_SMTP package. Or look for some package written on top of it since it's no joy to use if you aren't familiar with the low level stuff. Not sure if it handles attachments, something written against the JavaMail API is probably more flexible for that

  • Sending E-mail Through Oracle Forms

    Hi all
    what i want is as the following:
    1- i would like to convert the report to the PDF file internally using code.
    2- open the outlook.
    3- attcah the PDF automatically to the e-mail.
    4- finally sending the e-mail though outlook
    could i do that in Oracle forms 6i if i could do that can anyone instruct me to do it step by step

    Oh...it's now called ["My Oracle Support"|https://metalink.oracle.com/] .
    There's a note on "My Oracle Support" on this item.
    This is the note:
    Subject:      OLE AUTOMATION: Example Sending a Mail From Forms to Outlook
           Doc ID:      119828.1      Type:      BULLETIN
           Modified Date :      02-SEP-2008      Status:      PUBLISHED
    PURPOSE
    This document contains a sample code how to send an e-mail from Forms to Outlook
    (97-2000). 
    SCOPE & APPLICATION
    It can be used in addition of the whitepaper "Cracking Outlook!", which explains
    the object model of Outlook in detail.
    (Have a look in the Technical Libaries Folder Forms Whitepaper, their you can
    find it)
    OLE: Forms to Outlook
    Object Model
    "Cracking outlook!" explains the Object Model, you can find additional
    information in the Visual Basic Help of Outlook, which must be installed from
    your Office CD-Rom.  Once installed, you can access the help
    by choosing Tools->Macro->Visual Basic Editor and then go to the Help or
    Object Browser (view -> Object Browser)
    Now you can retrieve the Objects, their Methods and Properties. 
    Eg: the 'Application' Object has the Method 'CreateItem'.
    Note this information is also available in MSDN library or if you require more
    information on this Microsoft has to be contacted.
    OLE2, CLIENT_OLE2 Package
    Once you know the Objects, Methods and Properties you can access them with the
    OLE2 package.  This package provides a PL/SQL API for creating, manipulating,
    and accessing attributes of OLE2 automation objects.  When using OLE2 with
    WebForms every call will be executed on the midtier and not on the client. 
    So alternatively, the CLIENT_OLE2 package can be used, that is delivered by
    Webutil, to execute the OLE code on the client.
    Examples
    Once you know the Outlook Object model and you know the functions of the OLE2
    or CLIENT_OLE2 package you can write your own OLE2/CLIENT_OLE2 code to send a
    mail via Outlook.
    Here below are 2 different ways of sending an email using Outlook. 
    Sample 1:
    OLE2 sample: Here a MailItem is created, then the Recepient is explicitely
    added and resolved.  The mailItem is saved before being sent.
    Declare
    /*declaration of the Outlook Object Variables*/
    application ole2.OBJ_TYPE;     
    hMailItem ole2.OBJ_TYPE;
    hRecipients ole2.OBJ_TYPE;
    recipient ole2.OBJ_TYPE;
    nameSpace OLE2.OBJ_TYPE;
    /*declaration of the argument list*/ 
    args OLE2.LIST_TYPE;          
    begin
    /*create the Application Instance*/
    application:=ole2.create_obj('Outlook.Application');          
    /* create namespace and login */
    args:=ole2.create_arglist;
    ole2.add_arg(args,'MAPI');
    nameSpace:=ole2.invoke_obj(application,'getNameSpace',args);
    ole2.destroy_arglist(args);
    ole2.invoke(nameSpace,'Logon');
    /*create a Mail Instance by calling CreateItem Method and giving argument 0 with
    it,
    you can find the item types in the explanation of the CreateItem Method
    (0=olMailItem,1=olAppointmentItem, ?)*/
    args:=ole2.create_arglist;                         
    ole2.add_arg(args,0);
    hMailItem:=ole2.invoke_obj(application,'CreateItem',args);
    ole2.destroy_arglist(args);
    /*Get the Recipients property of the MailItem object: 
    Returns a Recipients collection that represents all the Recipients for the
    Outlook item*/
    args:=ole2.create_arglist;
    hRecipients:=ole2.get_obj_property(hMailItem,'Recipients',args);
    ole2.destroy_arglist(args);
    /*Use the Add method to create a recipients Instance and add it to the
    Recipients collection*/
    args:=ole2.create_arglist;
    ole2.add_arg(args,'[email protected]');
    recipient:=ole2.invoke_obj(hRecipients,'Add',args);
      /* put the property Type of the recipient Instance  to value needed
    (0=Originator,1=To,2=CC,3=BCC)*/
    ole2.set_property(recipient,'Type',1);
    ole2.destroy_arglist(args);
    /*Resolve the Recipients collection*/
    args:=ole2.create_arglist;
    ole2.invoke(hRecipients,'ResolveAll',args);
    /*set the Subject and Body properties*/
    ole2.set_property(hMailItem,'Subject','Test OLE2 to Outlook');
    ole2.set_property(hMailItem,'Body','this is body text');
    /*Save the mail*/
    ole2.invoke(hMailItem,'Save',args);
    ole2.destroy_arglist(args);
    /*Send the mail*/
    args:=ole2.create_arglist;
    ole2.invoke(hMailItem,'Send',args);
    ole2.destroy_arglist(args);
    /*Release all your Instances*/
    release_obj(hMailItem);
    release_obj(recipient);
    release_obj(hRecipients);
    release_obj(nameSpace);
    release_obj(application);
    end;
    Sample 2
    CLIENT_OLE2 sample.  Here a MailItem is created with an attachment and directly
    sent.
    Declare
    objOutlook CLIENT_OLE2.OBJ_TYPE;
    objMail CLIENT_OLE2.OBJ_TYPE;
    objArg CLIENT_OLE2.LIST_TYPE;
    objAttach CLIENT_OLE2.OBJ_TYPE;
    nameSpace CLIENT_OLE2.OBJ_TYPE;
    BEGIN
    objOutlook := CLIENT_OLE2.CREATE_OBJ('Outlook.Application');
    /* create namespace and login */
    args:=client_ole2.create_arglist;
    client_ole2.add_arg(args,'MAPI');
    nameSpace:=ole2.invoke_obj(objOutlook,'getNameSpace',args);
    client_ole2.destroy_arglist(args);
    client_ole2.invoke(nameSpace,'Logon');
    -- Previous example usually used 'mapi.session' but this doesn't work correctly
    --anymore.
    objarg := CLIENT_OLE2.CREATE_ARGLIST;
    CLIENT_OLE2.ADD_ARG(objarg,0);
    objMail := CLIENT_OLE2.INVOKE_OBJ(objOutlook,'CreateItem', objarg);
    CLIENT_OLE2.DESTROY_ARGLIST(objarg);
    objAttach := CLIENT_OLE2.GET_OBJ_PROPERTY(objmail, 'Attachments');
    objarg := CLIENT_OLE2.CREATE_ARGLIST;
    CLIENT_OLE2.ADD_ARG(objarg,'c:\temp\test.txt'); -- filename
    CLIENT_OLE2.SET_PROPERTY(objmail,'To','[email protected]');
    CLIENT_OLE2.SET_PROPERTY(objmail,'Subject','Email sent from Oracle Forms 9i');
    CLIENT_OLE2.SET_PROPERTY(objmail,'Body','This is an email that was sent using
    CLIENT_OLE2 from Oracle forms 9i');
    CLIENT_OLE2.INVOKE(objattach, 'Add', objarg);
    CLIENT_OLE2.INVOKE(objmail,'Send');
    CLIENT_OLE2.RELEASE_OBJ(objmail);
    CLIENT_OLE2.RELEASE_OBJ(nameSpace);
    CLIENT_OLE2.RELEASE_OBJ(objOutlook);
    CLIENT_OLE2.DESTROY_ARGLIST(objarg);
    END;
    Notes:
    These are just 2 different ways of sending a mail by Outlook and using the
    Outlook Object Model.
    The first example can also be used with CLIENT_OLE2, and the second example can
    also be used with OLE2.
    (just replace every OLE2 to CLIENT_OLE2 or every CLIENT_OLE2 call to OLE2).

  • Send e-mail from oracle forms

    how can i send e-mail from within the form and without opening any e-mail program
    just one click on a button in the form the mail will be sent
    i'm working on nt os

    I use a program called BLAT which is a command line utility to send SMTP messages.
    ( Use the HOST built-in ).
    I tried using MAPI products but they did not work well on the web.
    null

  • Send E-mail from Oracle (9.2.0.1) : SMTP transient error: 421 Service not a

    I have used Oracle 9i server (9.2.0.1 version) on Windows XP machine(with SP2).I want to send Email from PL/SQL procedure.
    My Question is what sort of configuration needed to perform this activity?
    I have installed IIS (Internet Information Service)
    in my machine, then configure my SMTP mail server
    with a valid email id and password given TCP port 465.
    Later I came to know that to send Email from PL/SQL I have to install Oracle JServer Code. Follow three steps. the steps are
    1. Execute the script as sys "$ORACLE_HOME\javavm\install\initjvm.sql"
    2. Execute the loadjava classfile as
    $ORACLE_HOME\plsql\jlib>loadjava -f -v -r -u sys/**** plsql.jar
    3. Execute the script as sys "$ORACLE_HOME\rdbms\admin\initplsj.sql"
    I sucessfully executed the first step, but for the second step iam not able to locate the plsql.jar file in the specified path.
    So Please tell me if there is any other method to perform this task
    My code is as follows.
    CREATE OR REPLACE PROCEDURE SEND_MAIL (
                                  msg_to varchar2,
                                  msg_subject varchar2,
                                  msg_text varchar2
                                  IS
                                  c utl_smtp.connection;
                                  rc integer;
                                  msg_from varchar2(50) := '[email protected]';
                                  mailhost VARCHAR2(30) := 'mail.google.com';
                             BEGIN
                                  c := utl_smtp.open_connection(mailhost, 465);
                                  utl_smtp.helo(c, mailhost);
                                  utl_smtp.mail(c, msg_from);
                                  utl_smtp.rcpt(c, msg_to);
                                  dbms_output.put_line(' Start Sending data');
                                  utl_smtp.data(c,'From: Oracle Database' || utl_tcp.crlf ||
                                  'To: ' || msg_to || utl_tcp.crlf ||
                                  'Subject: ' || msg_subject ||
                                  utl_tcp.crlf || msg_text);
                                  dbms_output.put_line(' Finish Sending data');
                                  utl_smtp.quit(c);
              EXCEPTION
                   WHEN UTL_SMTP.INVALID_OPERATION THEN
    dbms_output.put_line(' Invalid Operation in Mail attempt using UTL_SMTP.');
                   WHEN UTL_SMTP.TRANSIENT_ERROR THEN
    dbms_output.put_line(' Temporary e-mail issue - try again');
    WHEN UTL_SMTP.PERMANENT_ERROR THEN
    dbms_output.put_line(' Permanent Error Encountered.');
    END;
    Procedure Created.
    SQL> execute prc_send_mail('[email protected]','[email protected]','Good Morning.');
    BEGIN prc_send_mail('[email protected]','[email protected]','Good Morning.'); END;
    ERROR at line 1:
    ORA-29278: SMTP transient error: 421 Service not available
    ORA-06512: at "SYS.UTL_SMTP", line 17
    ORA-06512: at "SYS.UTL_SMTP", line 96
    ORA-06512: at "SYS.UTL_SMTP", line 374
    ORA-06512: at "SCOTT.PRC_SEND_MAIL", line 19
    ORA-29278: SMTP transient error: 421 Service not available
    ORA-06512: at line 1.
    Please tell me how to solve this problem.
    Thank You.

    1) Why did you install an SMTP server locally and then tell your code to try to use the server mail.google.com?
    2) The error you're getting is from mail.google.com indicating that Google isn't running an open SMTP server there. I would be very surprised if Google were running a publicly available SMTP server anywhere since that would be an invitation for spammers.
    Justin

Maybe you are looking for

  • Can see shared CD drives on MBA, but cannot read any data from disks

    Puzzling one here. Have a MBA and am trying to use the shared drives on either a Windows XP computer, or MacBookPro notebook. Both computers are on the same wireless network, and both computers have DVD/CD sharing enabled. In the RemoteDisk shortcut

  • Photoshop CS v.8 open windows in Windows 7 cannot be moved, maximized, or closed

    I just installed my Photoshop CS Version 8 into Windows 7 on a new PC. When the program is opened, the File Browser icon does not toggle, and I have to go to File menu to open Browse. The browser window now cannot be moved, maximized, or closed. The

  • ACR 6.3RC still makes Bridge display some TIFFs & JPGs overexposed

    I had the same problem with TIFFs & JPGs after upgrading from ACR 6.1 to 6.2. My system is Win 7x64 and, of course, PsCS5 and Bridge 4.0.39. This time the upgrade was from ACR 6.1 to 6.3RC. Not all images are affected. The problem seems to be entirel

  • Print dialog font is too small: Acrobat Reader on Linux

    I'm running Acrobat Reader version 7.0.5 on CentOS 4.5 (RedHat Enterprise 4.5) and find that the fonts used on the Print dialog are too small. They are much smaller than the fonts used on labels and other controls in the rest of the application, and

  • Colour profiles of images are removed by Muse

    Muse removes the colour profile of images when resizing or cropping them. Apparently, colour profile is preserved when image is in original size. This is a MAJOR ISSUE not solved in more than eight months since it was reported. Muse is useless for an