reemy بتاريخ: 26 أبريل 2004 تقديم بلاغ مشاركة بتاريخ: 26 أبريل 2004 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 ( Mail Package BodyMail 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 )isBegin/* 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; اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
عبداللطيف بتاريخ: 26 أبريل 2004 تقديم بلاغ مشاركة بتاريخ: 26 أبريل 2004 thank اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
arab20002000 بتاريخ: 26 أبريل 2004 تقديم بلاغ مشاركة بتاريخ: 26 أبريل 2004 thanks اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
anas120jo بتاريخ: 4 يناير 2007 تقديم بلاغ مشاركة بتاريخ: 4 يناير 2007 bellow function 4 send email but must downlode first application server on server side to receve and send email FUNCTION send_mail ( p_sender IN VARCHAR2 , p_recipient IN VARCHAR2 , p_subject IN VARCHAR2 , p_message IN VARCHAR2 , p_mailhost IN VARCHAR2 DEFAULT '[email protected]') RETURN VARCHAR2IS v_mail_conn UTL_SMTP.connection; v_msg VARCHAR2 (4000); v_status VARCHAR2 (100) := 'Success'; crlf VARCHAR2 (2) := CHR (13) || CHR (10);BEGIN--Connect to server, listener 25 v_mail_conn := UTL_SMTP.open_connection (p_mailhost, 25);--Perform initial handshaking with SMTP server after connecting UTL_SMTP.helo (v_mail_conn, p_mailhost);--Initiate a mail transaction with the server. The destination is a mailbox. UTL_SMTP.mail (v_mail_conn, p_sender);--Specify the recipient UTL_SMTP.rcpt (v_mail_conn, p_recipient);--Add date, from, and subgject to message--Add passed in message to rest of message v_msg := 'Date: ' || TO_CHAR (SYSDATE, 'dd Mon yy hh24:mi:ss') || crlf || 'From: ' || p_sender || crlf || 'Subject: ' || p_subject || crlf || 'To: ' || p_recipient || crlf || '' || crlf || p_message;/*Note: If the length of v_msg is greater than 2000 the following errorwill occur ORA-06502: PL/SQL: numeric or value error so the message istruncated to 2000 characters*/ IF LENGTH (v_msg) > 2000 THEN v_msg := SUBSTR (v_msg, 1, 2000); END IF;--Specify the body of an email message UTL_SMTP.DATA (v_mail_conn, v_msg);--Terminate an SMTP session and disconnect from the server UTL_SMTP.quit (v_mail_conn); RETURN v_status;EXCEPTION WHEN OTHERS THEN RETURN ('Util.Send_Mail: ' || SQLERRM);END; اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
-=|mOOdY|=- بتاريخ: 4 يناير 2007 تقديم بلاغ مشاركة بتاريخ: 4 يناير 2007 مشكورين اخوان على الجهدجاري التجربة اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
عبداللطيف بتاريخ: 4 يناير 2007 تقديم بلاغ مشاركة بتاريخ: 4 يناير 2007 http://www.araboug.org/ib/index.php?showtopic=2427&hl=http://www.araboug.org/ib/index.php?showtopic=636&hl= اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
wlahmad بتاريخ: 10 فبراير 2007 تقديم بلاغ مشاركة بتاريخ: 10 فبراير 2007 بارك الله في حسناتك اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Faisal Matari بتاريخ: 19 يوليو 2016 تقديم بلاغ مشاركة بتاريخ: 19 يوليو 2016 هل ممكن تنزل فورمة جاهزة في مرفق ؟ !! اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Recommended Posts
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.