Utl_smtp package을 이용한 메일발송

전에 오라클 모니터링과 관련하여 민수님이 알려주신 utl_smtp package를 이용하여 메일받는 걸 테스트 중에 궁금한 사항이 생겼습니다.
http://kr.forums.oracle.com/forums/thread.jspa?threadID=426721&tstart=15
테이블 스페이스 사용량이 90%이상인 경우 메일 발송이 되게 하는 프로시져말인데요.
메일내용에 '90%이상 사용하고 있는 테이블스페이스 리스트'를 포함 시키는 방법이 있나요?
즉, alert 사항을 조건으로 만들었을 경우, 그 alert 내용을 메일 내용에 보여주는 방법이요.
'WARNING: Tablespace Freespace Alert!!' <---- 이 메시지 대신
모니터링이 필요한 테이블 스페이스가 보여지면 훨씬 좋을 것 같아서요.

Similar Messages

  • Regarding sending .PDF attachment through utl_smtp package

    Hi All,
    How can i send .PDF attachment throuch UTL_SMTP package using oacle pl/sql.
    Regds
    Shailesh

    http://www.google.com/search?q=UTL_SMTP+attachment
    results in a lot of hits how to do this; e.g.: http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    If you are having trouble with the above samples feel free to ask and don't forget to include as much information as possible (e.g. 4 digit database and forms version, your sample source code etc.).
    cheers

  • How can i use UTL_SMTP package in oracle 8i 1.5

    i want to use UTL_SMTP package to send mail but i have installed oracle 8i 1.5
    i know that UTL_SMTP package come with oracle 8i 1.6
    i will send mail from eudora
    thanks

    Hi,
    Run d:/oracle/ora81/rdbms/admin/utlsmtp.sql as SYS user. It create the package UTL_SMTP.
    Hope this helps.
    rukmini

  • Mail using utl_smtp package

    can we send attachment with mail by using utl_smtp package.
    i am using form6i with database 9i in 2 tier environment

    Hi,
    read the following:
    Can 9i email utl_smtp send attachments? ,
    Re: sending attchements with utl_smtp
    As an alternative there is also the UTL_MAIL built-in package as well...
    Regards,
    Simon

  • How to test status of email server with utl_smtp package

    Hi All,
    I plan to use the "maildemo" codesamples here at OTN (with due credit). I have to modify the package such that when I am trying to send an email I should be able to know the success/ failure of the transmission. How can I add this method to the package. How to determine using UTL_SMTP package the status of the mail server.
    I understand it returns "ORA-29278: SMTP transient error: 421 Service not available" error message if the mail server is invalid ( to simulate the down condition).
    Can anyone help me on this please.
    Thanks in advance,
    Sudhindra

    You can write an exception handler. In the simplest form:
    begin
    v_conn:= utl_smtp.open_connection(v_smtp_server, 25);
    exception
    when others then
    raise_application_error(-20010,'Not able to connect');
    end;
    Or you can catch the specific error you are looking for only.

  • Utl_smtp Package issue

    Hi
    We are using Oracle 8.1.5 Database.I want to use Oracle UTL_SMTP package for sending email notifiaction from oracle.I have already executed the script utlsmtp.sql from ORAHOME\RDBMS\ADMIN folder as system user.But when i use this in my code and execute the PL/SQL procedure
    It gives an errors as
    ORA-04068: existing state of packages has been discarded
    ORA-04067: not executed, package body "SYSTEM.UTL_SMTP" does not exist
    Declare
    SendorAddress Varchar2(30) := '[email protected]';
    ReceiverAddress varchar2(30) := '[email protected]';
    EmailServer varchar2(30) := '172.17.16.69';
    Port number := 25;
    conn system.UTL_SMTP.CONNECTION;
    crlf VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );
    mesg VARCHAR2( 4000 );
    mesg_body varchar2(4000);
    BEGIN
    conn:= system.utl_smtp.open_connection( EmailServer, Port );
    system.utl_smtp.helo( conn, EmailServer );
    system.utl_smtp.mail( conn, SendorAddress);
    system.utl_smtp.rcpt( conn, ReceiverAddress );
    mesg:= 'Date: '||TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' )|| crlf ||
    'From:'||SendorAddress|| crlf ||
    'Subject: Mail Through ORACLE Database' || crlf ||
    'To: '||ReceiverAddress || crlf ||
    '' || crlf ||' This is Mail from Oracle Database By Using UTL_SMTP Package'||crlf||'It is very easy to configure Tell me if you face any problems' ;
    system.utl_smtp.data( conn, mesg );
    system.utl_smtp.quit( conn );
    END;
    Please suggest me how to correct it .Or if there is any other way to send an email through oracle 8.1.5.0 then please let me know.
    Thanks in Advance

    You shoulld follow Sybrand's suggestions then. As I understand it the package wasn't installed correctly.
    The problem is you executed it as the SYSTEM user. All Oracle provided packages should be executed as the SYS user, as is documented in the package header.
    You need to drop the SYSTEM.utl_smtp package, and re-execute the code as SYS.
    select distinct owner from all_source where name = 'UTL_SMTP' and type = 'PACKAGE' should give you SYS if not proceed as above.
    Regards
    Etbin
    Edited by: Etbin on Apr 14, 2009 12:10 PM

  • Attaching files in a mail using utl_smtp package

    I am using a batch file to automate
    execution of a sql script. The script would generate a .csv file and I now need to mail this file to a user at regular intervals.
    Please suggest a good tool to attach the file and send a mail. I tried utl_smtp package, but its not possible to attach a file and also, the text size should not be more than 1000 characters.
    Thank you,

    http://www.softtreetech.com/
    has a package DB mail.
    Check this out.

  • UTL_SMTP PACKAGE을 사용하여 E-MAIL을 GENERATE하는 과정

    제품 : PL/SQL
    작성날짜 : 2003-06-27
    ======================================================
    UTL_SMTP PACKAGE을 사용하여 E-MAIL을 GENERATE하는 과정
    ======================================================
    PURPOSE
    UTL_SMTP package는 Oracle8i Release 2 (8.1.6)이상에서 UTL_TCP package을
    이용하여 e-mail 을 PL/SQL에서 generate하는 것이 가능하게 하였다.
    Explanation
    UTL_SMTP packag을 사용하기 위해서는 Database에 Java option이 install되어 있어야
    하며 TCPConnection class인 $ORACLE_HOME/plsql/jlib/plsql.jar file이
    load되어 있어야 한다. 그리고 JAVA_POOL_SIZE는 40M이상을 권장한다.
    UTL_SMTP package을 사용하여 E-mail을 generate하는 과정을 살펴보자.
    1. SMTP server을 이용하여 connection을 맺는다. (보통 25번 port을 사용한다)
    이것은 UTL_SMTP.OPEN_CONNECTION() function call을 통해 가능하다.
    Ex) utl_smtp.open_connection(mailhost,25)
    2. SMTP server와 UTL_SMTP.HELO() call을 통해 초기화을 한다.
    Ex) utl_smtp.helo(mail_conn,mailhost);
    3. UTL_SMTP.MAIL()을 이용하여 'From' mail ID 를 지정한다.
    Ex) utl_smtp.mail(mail_conn,sender);
    4. UTL_SMTP.RCPT()을 이용하여 'To' mail ID 를 지정한다.
    Ex) utl_smtp.rcpt(mail_conn,recipient);
    5. Body의 message을 정렬시에는 <CR><LF>에 의해 line을 나눌 수 있다.
    Ex) CHR(13)||CHR(10)
    6. UTL_SMTP.DATA() 응 이용하여 UTL_SMTP buffer로 message을 pass한다.
    Ex) utl_smtp.data(mail_conn,message);
    7. UTL_SMTP.QUIT()을 call함으로써 SMTP connection을 끝내게 된다.
    Ex) utl_smtp.quit(mail_conn);
    좀더 자세한 sample은 bulletin : 12130에서 보기로 하고 여기선 간단히 E-mail을
    보내는 sample을 보여주기로 한다.
    Example
    CREATE OR REPLACE PROCEDURE send_email
    ( sender IN VARCHAR2,
    recipient IN VARCHAR2,
    message IN VARCHAR2)
    AS
    mailhost VARCHAR2(100) := 'gmapacsmtp.oraclecorp.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);
    END;
    SQL> exec send_email('Oracle','[email protected]','This sample is education purpose only');
    Sample2) 한글 data을 mail로 보낼때는 bulletin : 12130을 자세히 보면
    알 수 있듯이 Sample1의 utl_smtp.data(mail_conn,message);
    부분을 바꾸어 주어야 한다.
    CREATE OR REPLACE PROCEDURE send_email
    ( sender IN VARCHAR2,
    recipient IN VARCHAR2,
    message IN VARCHAR2)
    AS
    mailhost VARCHAR2(100) := 'gmapacsmtp.oraclecorp.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.open_data(mail_conn);
    utl_smtp.write_raw_data(mail_conn, UTL_RAW.CAST_TO_RAW(message));
    utl_smtp.close_data(mail_conn);
    utl_smtp.quit(mail_conn);
    END;
    SQL> exec send_email('Oracle','[email protected]','이 샘플은 교육목적입니다.');
    Reference Ducumment
    Korean bulletin : 12130
    <Note:106513.1>

  • Formatting emails:I am using UTL_SMTP package foe sending them.

    Hi
    I created a PL/SQL job to schedule email sending. The code looks like:
    DECLARE
    l_mailhost VARCHAR2(64) := 'qiudubcorrel001.qa.local';
    l_from VARCHAR2(64) := '[email protected]';
    l_to VARCHAR2(64) := '[email protected]';
    l_mail_conn UTL_SMTP.connection;
    BEGIN
    l_mail_conn := UTL_SMTP.open_connection(('10.253.14.240'), 25);
    UTL_SMTP.helo(l_mail_conn, '10.253.14.240');
    UTL_SMTP.mail(l_mail_conn, l_from);
    UTL_SMTP.rcpt(l_mail_conn, l_to);
    UTL_SMTP.data(l_mail_conn, 'Single string message.' || Chr(13));
    UTL_SMTP.quit(l_mail_conn);
    END;
    The code works fine, but now I want to add colour to my email, or introduce other formatting as well. How can I do that here?
    Thanks,
    Kamal

    Here you can find HTML formatting
    * PROCEDURE NAME : XX_EMAIL_FILES
    * DESCRIPTION:
    * ==========
    * Sends e-mail (text and/or html, either as a string or from a file)
    * to one or more recipients (including cc and/or bcc recipients), along with
    * up to 3 file attachments (text and/or binary; default is text/plain), using
    * the UTL_SMTP package to send the e-mail, the DBMS_LOB package to read
    * binary file attachments, and the UTL_ENCODE package to convert the binary
    * attachments to BASE64 for character string (non-binary) transmission.
    * BE AWARE THAT A COMMIT MAY BE DONE BY THIS ROUTINE.
    * PARAMETERS:
    * ==========
    * The complete parameter list for the xx_email_files procedure is shown below:
    * NAME TYPE DESCRIPTION
    * from_name IN Name and e-mail address to put in the From field
    * to_names IN Names and e-mail addresses for the To field (separated by
    * commas or semicolons)
    * subject IN Text string for Subject field
    * message IN Text string or text file name for Message, if any
    * html_message IN Html string or html file name for Message, if any
    * cc_names IN Names and e-mail addresses for the Cc field, if any
    * (separated by commas or semicolons)
    * bcc_names IN Names and e-mail addresses for the Bcc field, if any
    * (separated by commas or semicolons)
    * filename1 IN First unix file pathname to attach, if any
    * filetype1 IN Mime type of first file (defaults to 'text/plain')
    * filename2 IN Second unix file pathname to attach, if any
    * filetype2 IN Mime type of second file (defaults to 'text/plain')
    * filename3 IN Third unix file pathname to attach, if any
    * filetype3 IN Mime type of third file (defaults to 'text/plain')
    * Sample names and e-mail addresses are: arun (attaches @),
    * [email protected], , xxx , and
    * "xxx"
    * A sample call in PL/SQL is shown below, which sends a text and html message,
    * plus a text file and two binary files (note: the slash after "end;" must be
    * the first character on it's line):
    * begin
    * xx_email_files(from_name => '[email protected]' ,
    * to_names => '[email protected]',
    * subject => 'A test',
    * message => 'A TEST MESSAGE',
    * html_message => '
    A test message
    * filename1 => '/ora_appl/oracle/11.5.0/data/xxx.pdf',
    * filename2 => '/usr/tmp/115apug.pdf',
    * filetype2 => 'application/pdf',
    * filename3 => '',
    * filetype3 => 'image/jpeg'
    * end
    * If the message or html_message string has a file name in it (starting with
    * a forward slash), the text or html file is copied into the e-mail as the
    * message or html message; otherwise, the message or html_message is copied
    * into the e-mail as-is.
    * Attachment file types (mime types) that I've tested include:
    * text/plain,
    * text/html,
    * image/jpeg,
    * image/gif,
    * application/pdf,
    * application/msword
    * A list of mime types can be seen at:
    * http://www.webmaster-toolkit.com/mime-types.shtml
    * If the mime type does not begin with "text", it is assumed to be a binary
    * file that will be encoded as base64 before transmission.
    CREATE OR REPLACE PROCEDURE xx_email_files (
    from_name VARCHAR2,
    to_names VARCHAR2,
    subject VARCHAR2,
    MESSAGE VARCHAR2 DEFAULT NULL,
    html_message VARCHAR2 DEFAULT NULL,
    cc_names VARCHAR2 DEFAULT NULL,
    bcc_names VARCHAR2 DEFAULT NULL,
    filename1 VARCHAR2 DEFAULT NULL,
    filetype1 VARCHAR2 DEFAULT 'text/plain',
    filename2 VARCHAR2 DEFAULT NULL,
    filetype2 VARCHAR2 DEFAULT 'text/plain',
    filename3 VARCHAR2 DEFAULT NULL,
    filetype3 VARCHAR2 DEFAULT 'text/plain'
    IS
    -- Change the SMTP host name and port number below to your own values,
    -- if not localhost on port 25:
    smtp_host VARCHAR2 (256) := 'localhost';
    smtp_port NUMBER := 25;
    -- Change the boundary string, if needed, which demarcates boundaries of
    -- parts in a multi-part email, and should not appear inside the body of
    -- any part of the e-mail:
    boundary CONSTANT VARCHAR2 (256) := 'CES.Boundary.DACA587499938898';
    recipients VARCHAR2 (32767);
    directory_path VARCHAR2 (256);
    file_name VARCHAR2 (256);
    crlf VARCHAR2 (2) := CHR (13) || CHR (10);
    mesg VARCHAR2 (32767);
    conn UTL_SMTP.connection;
    l_length NUMBER;
    l_sub VARCHAR2 (32767);
    TYPE varchar2_table IS TABLE OF VARCHAR2 (256)
    INDEX BY BINARY_INTEGER;
    file_array varchar2_table;
    type_array varchar2_table;
    i BINARY_INTEGER;
    -- Function to return the next email address in the list of email addresses,
    -- separated by either a "," or a ";". From Oracle's demo_mail. The format
    -- of mailbox may be in one of these:
    -- someone@some-domain
    -- "Someone at some domain"
    -- Someone at some domain
    FUNCTION get_address (addr_list IN OUT VARCHAR2)
    RETURN VARCHAR2
    IS
    addr VARCHAR2 (256);
    i PLS_INTEGER;
    FUNCTION lookup_unquoted_char (str IN VARCHAR2, chrs IN VARCHAR2)
    RETURN PLS_INTEGER
    IS
    c VARCHAR2 (5);
    i PLS_INTEGER;
    len PLS_INTEGER;
    inside_quote BOOLEAN;
    BEGIN
    inside_quote := FALSE;
    i := 1;
    len := LENGTH (str);
    WHILE (i <= len)
    LOOP
    c := SUBSTR (str, i, 1);
    IF (inside_quote)
    THEN
    IF (c = '"')
    THEN
    inside_quote := FALSE;
    ELSIF (c = '\')
    THEN
    i := i + 1; -- Skip the quote character
    END IF;
    GOTO next_char;
    END IF;
    IF (c = '"')
    THEN
    inside_quote := TRUE;
    GOTO next_char;
    END IF;
    IF (INSTR (chrs, c) >= 1)
    THEN
    RETURN i;
    END IF;
    <>
    i := i + 1;
    END LOOP;
    RETURN 0;
    END;
    BEGIN
    addr_list := LTRIM (addr_list);
    i := lookup_unquoted_char (addr_list, ',;');
    IF (i >= 1)
    THEN
    addr := SUBSTR (addr_list, 1, i - 1);
    addr_list := SUBSTR (addr_list, i + 1);
    ELSE
    addr := addr_list;
    addr_list := '';
    END IF;
    i := lookup_unquoted_char (addr, '<');
    IF (i >= 1)
    THEN
    addr := SUBSTR (addr, i + 1);
    i := INSTR (addr, '>');
    IF (i >= 1)
    THEN
    addr := SUBSTR (addr, 1, i - 1);
    END IF;
    END IF;
    RETURN addr;
    END;
    -- Procedure to split a file pathname into its directory path and file name
    -- components.
    PROCEDURE split_path_name (
    file_path IN VARCHAR2,
    directory_path OUT VARCHAR2,
    file_name OUT VARCHAR2
    IS
    pos NUMBER;
    BEGIN
    -- Separate the filename from the directory name
    pos := INSTR (file_path, '/', -1);
    IF pos = 0
    THEN
    pos := INSTR (file_path, '\', -1);
    END IF;
    IF pos = 0
    THEN
    directory_path := NULL;
    ELSE
    directory_path := SUBSTR (file_path, 1, pos - 1);
    END IF;
    file_name := SUBSTR (file_path, pos + 1);
    END;
    -- Procedure to append a file's contents to the e-mail
    PROCEDURE append_file (
    directory_path IN VARCHAR2,
    file_name IN VARCHAR2,
    file_type IN VARCHAR2,
    conn IN OUT UTL_SMTP.connection
    IS
    generated_name VARCHAR2 (30)
    := 'CESDIR' || TO_CHAR (SYSDATE, 'HH24MISS');
    directory_name VARCHAR2 (30);
    file_handle UTL_FILE.file_type;
    bfile_handle BFILE;
    bfile_len NUMBER;
    pos NUMBER;
    read_bytes NUMBER;
    line VARCHAR2 (1000);
    DATA RAW (200);
    my_code NUMBER;
    my_errm VARCHAR2 (32767);
    BEGIN
    BEGIN
    -- Grant access to the directory, unless already defined, and open
    -- the file (as a bfile for a binary file, otherwise as a text file).
    BEGIN
    line := directory_path;
    SELECT dd.directory_name
    INTO directory_name
    FROM dba_directories dd
    WHERE dd.directory_path = line AND ROWNUM = 1;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    directory_name := generated_name;
    END;
    IF directory_name = generated_name
    THEN
    EXECUTE IMMEDIATE 'create or replace directory '
    || directory_name
    || ' as '''
    || directory_path
    || '''';
    EXECUTE IMMEDIATE 'grant read on directory '
    || directory_name
    || ' to public';
    END IF;
    IF SUBSTR (file_type, 1, 4) != 'text'
    THEN
    bfile_handle := BFILENAME (directory_name, file_name);
    bfile_len := DBMS_LOB.getlength (bfile_handle);
    pos := 1;
    DBMS_LOB.OPEN (bfile_handle, DBMS_LOB.lob_readonly);
    ELSE
    file_handle := UTL_FILE.fopen (directory_name, file_name, 'r');
    END IF;
    -- Append the file contents to the end of the message
    LOOP
    -- If it is a binary file, process it 57 bytes at a time,
    -- reading them in with a LOB read, encoding them in BASE64,
    -- and writing out the encoded binary string as raw data
    IF SUBSTR (file_type, 1, 4) != 'text'
    THEN
    IF pos + 57 - 1 > bfile_len
    THEN
    read_bytes := bfile_len - pos + 1;
    ELSE
    read_bytes := 57;
    END IF;
    DBMS_LOB.READ (bfile_handle, read_bytes, pos, DATA);
    UTL_SMTP.write_raw_data (conn, UTL_ENCODE.base64_encode (DATA));
    pos := pos + 57;
    IF pos > bfile_len
    THEN
    EXIT;
    END IF;
    -- If it is a text file, get the next line of text, append a
    -- carriage return / line feed to it, and write it out
    ELSE
    UTL_FILE.get_line (file_handle, line);
    UTL_SMTP.write_data (conn, line || crlf);
    END IF;
    END LOOP;
    -- Output any errors, except at end when no more data is found
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    NULL;
    WHEN OTHERS
    THEN
    my_code := SQLCODE;
    my_errm := SQLERRM;
    DBMS_OUTPUT.put_line ('Error code ' || my_code || ': ' || my_errm);
    END;
    -- Close the file (binary or text)
    IF SUBSTR (file_type, 1, 4) != 'text'
    THEN
    DBMS_LOB.CLOSE (bfile_handle);
    ELSE
    UTL_FILE.fclose (file_handle);
    END IF;
    IF directory_name = generated_name
    THEN
    EXECUTE IMMEDIATE 'drop directory ' || directory_name;
    END IF;
    END;
    BEGIN
    -- Load the three filenames and file (mime) types into an array for
    -- easier handling later
    file_array (1) := filename1;
    file_array (2) := filename2;
    file_array (3) := filename3;
    type_array (1) := filetype1;
    type_array (2) := filetype2;
    type_array (3) := filetype3;
    -- Open the SMTP connection and set the From and To e-mail addresses
    conn := UTL_SMTP.open_connection (smtp_host, smtp_port);
    UTL_SMTP.helo (conn, smtp_host);
    recipients := from_name;
    UTL_SMTP.mail (conn, get_address (recipients));
    recipients := to_names;
    WHILE recipients IS NOT NULL
    LOOP
    UTL_SMTP.rcpt (conn, get_address (recipients));
    END LOOP;
    recipients := cc_names;
    WHILE recipients IS NOT NULL
    LOOP
    UTL_SMTP.rcpt (conn, get_address (recipients));
    END LOOP;
    recipients := bcc_names;
    WHILE recipients IS NOT NULL
    LOOP
    UTL_SMTP.rcpt (conn, get_address (recipients));
    END LOOP;
    UTL_SMTP.open_data (conn);
    -- Build the start of the mail message
    mesg :=
    'Date: '
    || TO_CHAR (SYSDATE, 'dd Mon yy hh24:mi:ss')
    || crlf
    || 'From: '
    || from_name
    || crlf
    || 'Subject: '
    || subject
    || crlf
    || 'To: '
    || to_names
    || crlf;
    IF cc_names IS NOT NULL
    THEN
    mesg := mesg || 'Cc: ' || cc_names || crlf;
    END IF;
    IF bcc_names IS NOT NULL
    THEN
    mesg := mesg || 'Bcc: ' || bcc_names || crlf;
    END IF;
    mesg :=
    mesg
    || 'Mime-Version: 1.0'
    || crlf
    || 'Content-Type: multipart/mixed; boundary="'
    || boundary
    || '"'
    || crlf
    || crlf
    || 'This is a Mime message, which your current mail reader may not'
    || crlf
    || 'understand. Parts of the message will appear as text. If the remainder'
    || crlf
    || 'appears as random characters in the message body, instead of as'
    || crlf
    || 'attachments, then you''ll have to extract these parts and decode them'
    || crlf
    || 'manually.'
    || crlf
    || crlf;
    UTL_SMTP.write_data (conn, mesg);
    -- Write the text message or message file, if any
    IF MESSAGE IS NOT NULL
    THEN
    mesg :=
    || boundary
    || crlf
    || 'Content-Type: text/plain; name="message.txt"; charset=US-ASCII'
    || crlf
    || 'Content-Disposition: inline; filename="message.txt"'
    || crlf
    || 'Content-Transfer-Encoding: 7bit'
    || crlf
    || crlf;
    UTL_SMTP.write_data (conn, mesg);
    IF SUBSTR (MESSAGE, 1, 1) = '/'
    THEN
    split_path_name (MESSAGE, directory_path, file_name);
    append_file (directory_path, file_name, 'text', conn);
    UTL_SMTP.write_data (conn, crlf);
    ELSE
    UTL_SMTP.write_data (conn, MESSAGE || crlf);
    END IF;
    END IF;
    IF html_message IS NOT NULL
    THEN
    mesg :=
    || boundary
    || crlf
    || 'Content-Type: text/html; name="message.html"; charset=US-ASCII'
    || crlf
    || 'Content-Disposition: inline; filename="message.html"'
    || crlf
    || 'Content-Transfer-Encoding: 7bit'
    || crlf
    || crlf;
    UTL_SMTP.write_data (conn, mesg);
    IF SUBSTR (html_message, 1, 1) = '/'
    THEN
    split_path_name (html_message, directory_path, file_name);
    append_file (directory_path, file_name, 'text', conn);
    UTL_SMTP.write_data (conn, crlf);
    ELSE
    UTL_SMTP.write_data (conn, html_message || crlf);
    END IF;
    END IF;
    -- Append the files
    FOR i IN 1 .. 3
    LOOP
    -- If the filename has been supplied ...
    IF file_array (i) IS NOT NULL
    THEN
    split_path_name (file_array (i), directory_path, file_name);
    -- Generate the MIME boundary line according to the file (mime) type
    -- specified.
    mesg := crlf || '--' || boundary || crlf;
    SELECT INSTR (file_name, '.')
    INTO l_length
    FROM DUAL;
    SELECT SUBSTR (file_name, 1, l_length - 1) || '.pdf'
    INTO l_sub
    FROM DUAL;
    IF SUBSTR (type_array (i), 1, 4) != 'text'
    THEN
    mesg :=
    mesg
    || 'Content-Type: '
    || type_array (i)
    || '; name="'
    || file_name
    || '"'
    || crlf
    || 'Content-Disposition: attachment; filename="'
    || file_name
    || '"'
    || crlf
    || 'Content-Transfer-Encoding: base64'
    || crlf
    || crlf;
    ELSE
    mesg :=
    mesg
    || 'Content-Type: application/octet-stream; name="'
    || file_name
    || '"'
    || crlf
    || 'Content-Disposition: attachment; filename="'
    || file_name
    || '"'
    || crlf
    || 'Content-Transfer-Encoding: 7bit'
    || crlf
    || crlf;
    END IF;
    UTL_SMTP.write_data (conn, mesg);
    -- Append the file contents to the end of the message
    append_file (directory_path, file_name, type_array (i), conn);
    UTL_SMTP.write_data (conn, crlf);
    END IF;
    END LOOP;
    -- Append the final boundary line
    mesg := crlf || '--' || boundary || '--' || crlf;
    UTL_SMTP.write_data (conn, mesg);
    -- Close the SMTP connection
    UTL_SMTP.close_data (conn);
    UTL_SMTP.quit (conn);
    END;
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com

  • Sending attachment file through utl_smtp package in oracle 8i

    dear friends,
    i am facing one problem here. I can send mail
    from oracle8i by using utl_smtp or utl_tcp package. but I am not able to send a file
    from perticular directory as attachments.
    how it will be possible. if any one have idea
    about this pl. guide me. it is very urgent.
    thanks in advance
    sunil kant pandey

    Can you provide me a sample code which sends a mail using utl_snmp package ?
    thanks in advance,
    kalpen.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by [email protected]:
    dear friends,
    i am facing one problem here. I can send mail
    from oracle8i by using utl_smtp or utl_tcp package. but I am not able to send a file
    from perticular directory as attachments.
    how it will be possible. if any one have idea
    about this pl. guide me. it is very urgent.
    thanks in advance
    sunil kant pandey<HR></BLOCKQUOTE>
    null

  • How to Install UTL_SMTP Package in Oracle 8.1.5

    Hi
    We are trying to use UTL_SMTO package to send mail.
    Will this package runs in Oracle 8.1.5? Any restriction on using this package?
    How to install this package? Where the SQL for this package is residing.
    If anyone can answer for this, we will be thankfull to you.
    regards
    Santhosh

    Hi,
    Run d:/oracle/ora81/rdbms/admin/utlsmtp.sql as SYS user. It create the package UTL_SMTP.
    Hope this helps.
    rukmini

  • UTL_SMTP package not working in trigger

    Hello Friends,
    I have created a trigger through which i am trying to send a mail.but it gives an error message as:
    ORA-30678: too many open connections
    Also when i run the same script at the SQL Prompt, it will send the email to mentioned recipients.
    Please help me in resolving this issue...
    Thanks in advance,
    Ankur

    > I have created a trigger through which i am trying to send a mail
    That is a very wrong approach to use. The purpose of a trigger is to protect data integrity. It is not a do-everything-with-it-including-washing-the-windows tool.
    A trigger can submit a DBMS_JOB that in turn will do an e-mail shot. A trigger can insert an e-mail request into a table (queue) for a DBMS_JOB to pick up and process.
    But a trigger that performs external functions (like sending mail, accessing the o/s command line, etc) compromises the business transaction - and make it dependant on external and non-related factors to make it succeed. What if the e-mail address is wrong? What if the POP mailbox of the recipient is full/ What if the mail server is down for 5 minutes maintenance? What if that specific network router/gateway/switch is down?
    Fail the business transaction because of the trigger attempting to do what it is not suppose to do?
    External functions have no place in a trigger.

  • UTL_SMTP Installation Problem, Package Created with errors

    Hi Forum Friend!
    I tried to Install UTL_SMTP Package in my Oracle8 Release 8.0.6.1.0. A friend of mine sent me the UtLSMTP.SQL Script and I run from SQL+ connected as SYS. When I check the Package by the Oracle Schema Manager I Notice that UTL_SMTP has errors so the package will not run successfully. The Errors are the following:
    PLS-00103: Encountered the symbol "CONNECTION" when expecting one of the following:
    := . ) , @ % default character
    The symbol ":=" was substituted for "CONNECTION" to continue.
    I have no Idea how to handle this error. I tried to install the Package in my Developing Database But the Production Database is in HPUX(Unix). Could you please send me some recommendation to solve this issue and start executing the package!
    Best Regards
    Emmanuel Carrillo Trejos
    P.D. LNB, Republic of Panama (Central America).

    Dear Friends
    Well, I think that my Database version is too old to use this package. I think that one time looking for this topic I found something relating sending email using a Host call(I think that using Mail Command from Unix) Does anybody has and Idea how to do it?. Thanks for your time colleagues!
    Best Regards
    Emmanuel Carrillo Trejos
    LNB, Panamà.

  • Email sending is not working with utl_smtp (migrated from 9i to 11g)

    Hi,
    >
    We have used UTL_SMTP package to send emails in Oracle 9i. But when we have migrated to Oracle 11g, the procedure used to send emails compiled successfully, but we were not able to receive the mails.
    Not able to figure out the exact issue/error.
    Please let me know if there is any solution other than using UTL_MAIL in 11g.
    Thanks,
    Saranya

    Hi
    I faced similar issue that happened due to ACLs. Check metalink note 557070.1 for details.
    Hope it helps.
    Rgds
    Adnan

  • Sending e-mail using utl_smtp on oracle 9i

    Hello
    I have problem with sending e-mails using utl_smtp package.
    My code looks like this:
    lv_mail_conn := utl_smtp.open_connection(lv_mailhost_txt);
    utl_smtp.ehlo(lv_mail_conn, lv_mailhost_txt);
    res :=     utl_smtp.command(lv_mail_conn, 'AUTH LOGIN');
    res := utl_smtp.command(lv_mail_conn, <login in base64>);
    res := utl_smtp.command(lv_mail_conn, <password in base64>);
    And I get en error after sending a password to SMTP server.
    Error code: 535, text: 5.7.3 Authentication unsuccessful.
    This happens on oracle 9i.
    I have another server for testing which has oracle 10g installed. This code works fine on oracle 10g but doesn't work on oracle 9i.
    Do you have any ideas what's wrong? I assume that SMTP server (microsoft exchange) work correctlys because I can send e-mail from test server.

    Ok problem solved :)
    Problem was between oracle and MS exchange server. Live server oracle 9i is on linux, and testing server works on windows.
    So the problem was with configuration. Our admins corrected it and now works :). I don't know details.

Maybe you are looking for

  • XI examples step by step screen shots

    hi experts, i am new in XI. i want to learn XI so any one plz help me how to create,how to install,connect,and SLD,ID,IR,ADAPTER,BPM,MAPPING plz send any documents for XI step by step examples with screen shots.it's really helpful for my carrier. tha

  • Credit Limit on basis by specific product

    Dear Experts, Could you please suggest me any body how to maintain credit limit by specific material (Product). Let say Customer Pepsi has 3 products i.e X,Y and Z....pepsi (customer) has credit limit 100 USD. Here the customer credit limit is 100 us

  • Loading an extranel SWF into movie

    Hi I'm trying to load an external SFW into my empty placeholder moveiclip. I can achive this fine using buttons and an onClick event, but how can I have this happen at the start of a movie clip with no human interaction. The code I am trying is below

  • Can I download Photoshop on a Mac or apple device?

    It's pretty self explanatory... When I first tried to download Adobe said it wasn't supporting my device which is a mac so I'm confused.

  • Issue with transformation class when i have same first name and last name

    Hi All, we have a custom transform that will get the record from the trusted recon from Oracle DB, build the User Login, then check the OIM DB USR table for the existance of the user id. - If the user ID already exist, then they modify the new one to