Sending email from a form (runtime)

Hi otn,
I wanna send an email with a text file attached from a form at run time mode.
can u help ?
Thank u

HERE IS CODE :
PROCEDURE kr_sendmail(
p_mail_subject IN VARCHAR2
,p_mail_to                IN VARCHAR2
,p_mail_cc                IN VARCHAR2 DEFAULT NULL
,p_mail_bcc           IN VARCHAR2 DEFAULT NULL
,p_mail_body           IN VARCHAR2 DEFAULT NULL
,p_attachment_source      IN VARCHAR2 DEFAULT NULL
,p_attachment_name           IN VARCHAR2 DEFAULT NULL
,p_display                IN BOOLEAN DEFAULT TRUE
,p_cisoe_id IN NUMBER DEFAULT 0
,pio_entry_id IN OUT VARCHAR2)
IS
c_cisoe_id               CONSTANT VARCHAR2
(30) := 'CISOEMAILID';
objArgL                         
     OLE2.OBJ_TYPE;
objAppOutlook           OLE2.OBJ_TYPE;
objNameSpace                OLE2.OBJ_TYPE;
objInBox                          OLE2.OBJ_TYPE;
--objFolders                     OLE2.OBJ_TYPE;
--objFolder                     OLE2.OBJ_TYPE;
objMailItem                    OLE2.OBJ_TYPE;
objAttachments          OLE2.OBJ_TYPE;
objAttachment               OLE2.OBJ_TYPE;
objUserProperties     OLE2.OBJ_TYPE;
objUserProperty          OLE2.OBJ_TYPE;
v_id_new                     VARCHAR2(2000);
v_id_folder           VARCHAR2(2000);
v_cisoe_id               NUMBER;
v_test BOOLEAN;
BEGIN
     -- Create Outlook Application Object
objAppOutlook := ole2.create_obj('Outlook.Application');
-- Get Namespace
objArgL := ole2.create_arglist;
ole2.add_arg(objArgL,'MAPI');
objNameSpace := ole2.invoke_obj
(objAppOutlook,'GetNamespace',objArgL);
ole2.destroy_arglist(objArgL);
-- Get InBox-Folder (Posteingang)
objArgL := ole2.create_arglist;
ole2.add_arg(objArgL,6);
objInBox := ole2.invoke_obj
(objNameSpace,'GetDefaultFolder',objArgL);
ole2.destroy_arglist(objArgL);
-- Create MailItem with properties
objArgL := ole2.create_arglist;
ole2.add_arg(objArgL,0);
objMailItem := ole2.invoke_obj
(objAppOutlook,'CreateItem',objArgL);
ole2.destroy_arglist(objArgL);
ole2.set_property(objMailItem,'To', p_mail_to);
ole2.set_property(objMailItem,'CC', p_mail_cc);
ole2.set_property(objMailItem,'BCC',p_mail_bcc);
ole2.set_property(objMailItem,'Subject',p_mail_subject);
ole2.set_property(objMailItem,'Body',p_mail_body);
--Test p_attachment_source
IF p_attachment_source IS NOT NULL THEN -- Create Attachment
--Test exist File
v_test := kr$fexists(p_attachment_source);
IF v_test = FALSE THEN --NOT TEXT_IO.IS_OPEN(v_test) THEN
--qms$errors.show_message(p_mesg=>'CKR-00022',p_param1 =>
1);
MESSAGE('Datei '||p_attachment_source||' ist nicht
existieren !');
RETURN;
ELSE
-- Create Attachment
objAttachments := ole2.get_obj_property
(objMailItem,'Attachments');
objArgL := ole2.create_arglist;
ole2.add_arg(objArgL,p_attachment_source);
ole2.add_arg(objArgL,1);                     --
property type
ole2.add_arg(objArgL,1);                     --
property position
ole2.add_arg(objArgL,p_attachment_name);     -- property name
objAttachment := ole2.invoke_obj
(objAttachments,'Add',objArgL);
ole2.destroy_arglist(objArgL);
END IF;
END IF;
-- Create User Property
objUserProperties := ole2.get_obj_property
(objMailItem,'UserProperties');
objArgL := ole2.create_arglist;
ole2.add_arg(objArgL,c_cisoe_id); -- property name
ole2.add_arg(objArgL,3);                     
     -- property type (number)
objUserProperty := ole2.invoke_obj
(objUserProperties,'Add',objArgL);
ole2.destroy_arglist(objArgL);
-- Set User Property
ole2.set_property(objUserProperty,'Value',p_cisoe_id);
-- Save
ole2.invoke(objMailItem,'Save');
-- Get Entry ID
v_id_new := ole2.get_char_property(objMailItem,'EntryID');
pio_entry_id := v_id_new;
-- Get User Property
v_cisoe_id := ole2.get_num_property(objUserProperty,'Value');
-- Create new Folder in InBox
-- objFolders := ole2.invoke_obj(objInBox,'Folders');
-- objArgL := ole2.create_arglist;
-- ole2.add_arg(objArgL,'MyFolder');
-- objFolder := ole2.invoke_obj(objFolders,'Add',objArgL);
-- ole2.destroy_arglist(objArgL);
-- Display Folder
-- ole2.invoke(objFolder,'Display');
-- Move Mail to new Folder
objArgL := ole2.create_arglist;
ole2.add_arg_obj(objArgL,objInbox); --objFolder);
ole2.invoke(objMailItem,'Move',objArgL);
ole2.destroy_arglist(objArgL);
v_id_folder := ole2.get_char_property(objMailItem,'EntryID');
-- Display or send
IF p_display
THEN
ole2.invoke(objMailItem,'Display');
ELSE
ole2.invoke(objMailItem,'Send');
END IF;
-- Release objects
ole2.release_obj(objUserProperty);
ole2.release_obj(objUserProperties);
--Test p_attachment_source
IF p_attachment_source IS NOT NULL THEN -- Create Attachment
ole2.release_obj(objAttachment);
ole2.release_obj(objAttachments);
END IF;
ole2.release_obj(objMailItem);
--ole2.release_obj(objFolder);
--ole2.release_obj(objFolders);
ole2.release_obj(objInBox);
ole2.release_obj(objNameSpace);
ole2.release_obj(objAppOutlook);
END kr_sendmail;

Similar Messages

  • How to sending email from Oracle Forms

    How to sending email from Oracle 6i(Forms)
    I need to send email to a distribution list(multiple email addresses).

    send email of multiple email address
    [email protected],[email protected],[email protected]
    create or replace function mailout
    (sender in varchar2,
    recipient in varchar2,
    ccrecipient in varchar2,
    subject in varchar2,
    message in varchar2) return number
    is
    crlf varchar2(2) := chr(13)||chr(10);
    connection utl_smtp.connection;
    mailhost varchar2(50) := 'Add email server Ip Address here';
    header varchar2(4000);
    v_num number :=1;
    str number:=0;
    email varchar2(50);
    begin
    connection := utl_smtp.open_connection(mailhost,25);
    header := 'Date: '||to_char(sysdate,'dd mon yy hh24:mi:ss')||crlf||
    'From: '||sender||' '||crlf||
    'Subject: '||subject||crlf||
    'To: '||recipient||crlf||
    'Cc: '||ccrecipient||crlf||message;
    utl_smtp.helo(connection,mailhost);
    utl_smtp.mail(connection,sender);
    utl_smtp.rcpt(connection,recipient);
    while (instr(ccrecipient,',',1,v_num)>0) loop
    email:=substr(ccrecipient,str+1,instr(ccrecipient,',',1,v_num)-str-1);
    dbms_output.put_line(email);
    utl_smtp.rcpt(connection,email);
    str:=instr(ccrecipient,',',1,v_num);
    v_num:=v_num+1;
    end loop;
    utl_smtp.open_data(connection);
    -- utl_smtp.write_data(connection,header);
    utl_smtp.write_data(connection,'MIME-Version:1.0'||crlf||'Content-type:text/html'||crlf||header);
    utl_smtp.close_data(connection);
    utl_smtp.quit(connection);
    return 0;
    exception
    when utl_smtp.invalid_operation then
    dbms_output.put_line('Invalid Operation in SMTP transaction');
    return 1;
    when utl_smtp.transient_error then
    dbms_output.put_line('Temporary problem with sending email ');
    return 2;
    when utl_smtp.permanent_error then
    dbms_output.put_line('Permanent problem with sending email ');
    return 3;
    end;

  • Sending email from Oracle Forms with attachments

    Hi,
    Is there any package or option available in Oracle forms to send email with attachments?
    Your reply will be highly appreciated.
    Regds,
    noneda

    There are a couple of ways to send email (with attachements) from Oracle Forms. Check out these links to some examples.
    using OLE2 or CLIENT_OLE2 to access a mail-client via Mail-Api ( Get and set Outlook properties )
    using MAILTO in conjunction with HOST or CLIENT_HOST to "start" a mail-client ( Re: Open Microsoft Outlook new massage with TO containing the email address )
    using UTL_SMTP for database-side-mailing ( Re: Send mail with attachment )
    Hope this helps,
    Craig...

  • Sending email from web forms (Forms 6i)

    Does anyone know how to send email using Outlook from web forms? I can get it working with client server but not with web forms.
    Thanks,
    Darcea Klein
    null

    Many ways to send a email:
    1. use Web.Show_Document(v_url, '_blank') to call a .asp or .php or .cgi page which can send email, attaching some message.
    2. use utl_smtp built_in in Oracle 8i, you can save this procedure in database, then call this procedure in your web form.
    PROCEDURE SEND_EMAIL (sender IN VARCHAR2,
    recipient IN VARCHAR2,
    message IN VARCHAR2)
    IS
    mailhost VARCHAR2(30) := 'smtp.aaaaa.com';
    mail_conn utl_smtp.connection;
    BEGIN
    mail_conn := utl_smtp.open_connection(mailhost, 25);
    utl_smtp.helo(mail_conn, mailhost);
    utl_smtp.mail(mail_conn, sender);
    utl_smtp.rcpt(mail_conn, recipient);
    utl_smtp.data(mail_conn, message);
    utl_smtp.quit(mail_conn);
    -- Handle the error
    END;
    GOOD LUCK

  • Sending email from oracle forms

    Hi, I want to send an email within oracle forms 10g.
    If anyone could help me.
    Thanks.

    Hi,
    I didn't understand.....
    Isn't it convienient to you , to create a button , for example , and call the UTL_MAIL.SEND(......<parameters given in text items of your form>......) buolt in procedure....????? or the equivalent procedure in UTL_SMTP ....????
    Regards,
    Simon

  • SAP screen frozen once in a while after sending email from adobe form

    Hi Experts,
    I am facing weird problems.
    I am using ABAP program to generate a adobe form.
    While testing, once in a while, after we clicked on the email icon on the adobe form, and then email sent out, we got frozen SAP screen. Sometimes, we need to hit keyboard: "ESC"/ "F3" to go back to SAP selection screen.
    Did you have this problem before? Please kindly advise.
    I am using Adobe Reader X 10, SAP GUI 710 patch 18.
    Thanks.
    Tee

    Hi Experts,
    I am facing weird problems.
    I am using ABAP program to generate a adobe form.
    While testing, once in a while, after we clicked on the email icon on the adobe form, and then email sent out, we got frozen SAP screen. Sometimes, we need to hit keyboard: "ESC"/ "F3" to go back to SAP selection screen.
    Did you have this problem before? Please kindly advise.
    I am using Adobe Reader X 10, SAP GUI 710 patch 18.
    Thanks.
    Tee

  • How to sending email from Oracle 6i(Forms)

    How can I send email from Oracle Forms(6i).
    I need to send email to a distribution list(multiple email addresses).

    send email of multiple email address
    [email protected],[email protected],[email protected]
    create or replace function mailout
    (sender in varchar2,
    recipient in varchar2,
    ccrecipient in varchar2,
    subject in varchar2,
    message in varchar2) return number
    is
    crlf varchar2(2) := chr(13)||chr(10);
    connection utl_smtp.connection;
    mailhost varchar2(50) := 'Add email server Ip Address here';
    header varchar2(4000);
    v_num number :=1;
    str number:=0;
    email varchar2(50);
    begin
    connection := utl_smtp.open_connection(mailhost,25);
    header := 'Date: '||to_char(sysdate,'dd mon yy hh24:mi:ss')||crlf||
    'From: '||sender||' '||crlf||
    'Subject: '||subject||crlf||
    'To: '||recipient||crlf||
    'Cc: '||ccrecipient||crlf||message;
    utl_smtp.helo(connection,mailhost);
    utl_smtp.mail(connection,sender);
    utl_smtp.rcpt(connection,recipient);
    while (instr(ccrecipient,',',1,v_num)>0) loop
    email:=substr(ccrecipient,str+1,instr(ccrecipient,',',1,v_num)-str-1);
    dbms_output.put_line(email);
    utl_smtp.rcpt(connection,email);
    str:=instr(ccrecipient,',',1,v_num);
    v_num:=v_num+1;
    end loop;
    utl_smtp.open_data(connection);
    -- utl_smtp.write_data(connection,header);
    utl_smtp.write_data(connection,'MIME-Version:1.0'||crlf||'Content-type:text/html'||crlf||header);
    utl_smtp.close_data(connection);
    utl_smtp.quit(connection);
    return 0;
    exception
    when utl_smtp.invalid_operation then
    dbms_output.put_line('Invalid Operation in SMTP transaction');
    return 1;
    when utl_smtp.transient_error then
    dbms_output.put_line('Temporary problem with sending email ');
    return 2;
    when utl_smtp.permanent_error then
    dbms_output.put_line('Permanent problem with sending email ');
    return 3;
    end;

  • Send Email from approval task form

    In my reusable workflow, I have added an approval action. Everything works perfectly. What I want is - When approver comes to approval form, he should be able to send notification email to the initiator (From that form) that he has started working on that document.
    What I have tried - I have added a button clicking on which will submit the form to initiator. 
    But it fails. possible reason - when I create a data connection in workflow's infopath form to submit form as email, I am getting following warning
    "Domain trust form templates cannot be sent as email attachments. to fix this problem, modify the form option to change the security level of form template to restricted".
    I also tried to update status field and wait for it to changes in workflow and send an email from sp designer workflow. it didn't work.
    Please help or suggest any other possible way to achieve this functionality (Send Email from approval task form to initiator).

    Hi mry,
    I could reproduce on my SharePoint 2013 on-premise based on your another
    post.
    Based on the the following article, SharePoint workflow cannot use the InfoPath form in restricted mode which doesn't allow the data connection, but as your image warning message shows sending InfoPath form as mail attachments will need restricted level.
    http://msdn.microsoft.com/en-us/library/office/ee526352.aspx
    You can consider to send a mail to initiator in "Whe a Task Completes" step when you click button approved/rejected, and construct the current task form link format as follow,
    http://sp/_layouts/15/WrkTaskIP.aspx?List=WorkflowTasksListGUID&ID=[%Current Task:ID%]
    Thanks
    Daniel Yang
    TechNet Community Support

  • How do I extract email from a form and send the PDF to that user?

    How do I extract email from a form and send the PDF to that user?

    here you can add email to send to, CC, Subject, and body message
    var oDoc = event.target;
                        oDoc.mailDoc({
                                                                bUI: false,
                                                                cTo: "Agency Contact Email",
                                                                cCC: "",
                                                                cSubject: "Write your title here,
                                                                cMsg: "Dear" + AgencyContact + "(" + AgencyContactEmail + ")\nThe student, " + FirstName + " " + LastName + " has applied to work at your agency. Please confirm they can work here blah blah blah.......\n\nThanks.\n\nrespectuflly,\n\nme"

  • How can i send emails from forms

    I need to be able to send emails from forms 6.(assuming the pc is running Outlook) What is the best way of doing this? Would OLE or DDE control of Outlook be the easiest method?
    If anyone has done this please let me know.

    See:
    iOS: Unable to send or receive email
    I would Google for:
    setup verizon email on phone
    for the settings to use.

  • Runtime error when sending email from PCUI

    Hi,
    When sending email from an activity in PCUI, I get runtime error, Line 2201, error, 'Object Expected'.
    Any idea?
    Thanks,
    AR

    Hi AR,
    This appears to be a javascript error. Could you give some more details about this error.
    Regards,
    Hemanth

  • Help: how to send emails from FORMS?

    Are there simple steps to send emails from FORMS?
    Thank you in advance.
    Jimmy

    I'm sure there are many ways to send emails from Forms. Personally I never had to do this, but I can imagine following ways.
    a) use UTL_SMTP-Package to send the email via your database
    b) use a Java-Call
    Peter

  • Still cannot send email from icloud .me address

    hi. does anybody knows why i cannot send email from my ipad (ios 5.0.1) icloud me.com account? i can recieve but i cannot send. on my mac (lion) it works perfectly. the message i get is "the sender address .mac.com was rejected by the server". mac.com ?? but i use my me.com address. any ideas pls?
    thank you

    I have been having the same problems for the last two days now.  It won't let me send, but it will let me save it to my drafts folder.  I even tried opening the e-mail form my iPhone 5 and it won't let me send it there either.  The last two times i ended up copying the contents from my failed e-mail on my phone and pasting that into a new e-mail and that works.  I normally use the icloud web app to reply to e-mails when i'm at work (using win 7) and it is very frustrating. 

  • Can't send email from Outlook with parentheses in address

    I can't send email from Outlook 2007 through my WRT400N when Outlook displays the address with parentheses as in this example: Firstname Lastname ([email protected])
    I can send if the address is in this form: Firstname Lastname <[email protected]>
    I have tested with the ISP and nothing gets through the router when the problem occurs. When I bypass the router, both forms of address will send correctly. This problem is perfectly reproducible. My router is brand new, but the problem did not show up for about a week after installation. OS is Win7. Any ideas? Thanks.
    -JimW
    Solved!
    Go to Solution.

    Try to forward the port 443 to 447 on the router.Check this link.

  • How do I fix Mail in Snow Leopard where I cannot send emails from my account to another account I've set up in Mail, but the reverse works fine?

    I have a problem with Mail in Snow Leopard in that I cannot set up two email accounts for myself and my wife with the same ISP and have them operate properly.  I've set up the accounts in strict accordance with my ISP's instructions for setting up email accounts on Mac Mail but I cannot send an email from my account to my wife's without a drop-down message appearing that Mail 'cannot send the email from this server.  Please edit the server list'.  No amount of tweaking appears to work.  Applecare consultants have so far been unable to get it to work and a recent visit to the local Genius Bar in the Apple Store was fruitless also.  My ISP's help line was unable to solve the problem even with a supervisor level consultant.  The ISP concluded it was some kind of 'bug' in Mail.
    I could send emails from my wife's account to mine, but not vice versa; I could send emails to other addresees without any problem and I can send emails from my account to my wife's using the ISP's webmail.
    Does anyone please have a solution to my problem?  At the moment we're operating one account (mine) on my Macbook and my wife's is set up on her iPad2.  As we prefer to use the Macbook for storage and (using Time Machine) for back-up of our data, the two accounts on separate machines is a nuisance.
    Another factor is that I prefer to control when I download emails and set my preferences accordingly.  One of the so-called 'fixes' that were tried wound up downloading emails regardless of settings, even after removing my wife's account; the matter was remedied only after I had removed all accounts form Mail and started afresh from scratch.

    You'll have to pardon my ignorance of some  computer terminology; I'm a retired manager and not a computer technician, hence my muddling up of client and server terminology.
    Re your comment about Port 339: I did qualify this with (?).  As I wrote, it all happened at lightining speed and the guy at the Genius Bar didn't bother explaining what he was doing.  Port designation contained 3s and 9s to the best of my recollection.
    That said, you seem to be spot on re setting up a 'dummy' client in Mail.  I set it up as you suggested and I can send to and receive from this client without a problem.  You appear to have identified the solution, notwithstanding the claims of the ISP's 'experts'.
    The next problem I have now is sorting out my wife's mailbox that is so troublesome whenever I set it up on Mail.
    All the other set-up advice to date yielded a similar result; inability to send from my account to her inbox.  Perhaps deleting her details from the account altogether and setting them up again from scratch may be the solution and I shall try that in due course.  The impediment that I have with this at the moment is that my ISP admits that it has 'a technical problem with its email servers' and some of its related web pages that prevent my doing this myself.  I will have to go through the telephone 'help' line and ask the technician to set it up at their end on my instructions.  This has some disadvantages in that I have to divulge the password to the account to the operator rather than keeping it anonymous by doing it on-line.   You may have solved the problem, but until I can successfully sort out a working mailbox for my wife i cannot definitively say so.
    Many thanks for your perseverance.  You've made more sense than anyone else so far and that deserves some points, surely?

Maybe you are looking for

  • Print module - print to file options

    When creating JPEGs using the Export function of the Library module, Lightroom 4 offers you very detailed control over the export options, including automated rules for the folder/filename structure. When creating JPEGs using "print to file" in the P

  • On start up, my MacBook Pro will just go dark and shut down. It clicks but does not chime. What's happening?

    My MacBook Pro on start-up with just go dark and shut down. It makes a clicking or popping sound but there is no chime or other typical Mac sound. I can push the power button again and it will generally power up. It is becoming more frequent with tim

  • Changes in ESR not reflecting in SPROXY

    Hi All, We are implementing SRM 7.0 with PI 7.1. We have a reuiquirement of adding custom fields in the standard message DespatchedDeliveryNotification_Out which is sent from SRM SUS. I have created the data type enhancement in the ESR in the namespa

  • Photos on ios 8

    I used to take pics via my iPhone and once they were saved in iCloud, then I used to delete the pics from camera roll in ios 7... But now after upgrading to ios 8 as we all know that camera roll has disappeared..... So now how do I delete pics from c

  • How to configure details form in the Timekeeper Entry screen

    Hi All, I am using Payroll Timecard Layout. Currently I have a requirement to configure the details form in the timekeeper entry screen to accomodate the timekeepers to enter additional 2 fields of information along with the comments in the details f