Utl_smtp issue?

Hi,
I am using the following source for mailing.
http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/maildemo_sql.txt
and i write a code like below to send the mail using the above package(demo_mail) and i using the oracle 9i
Declare
Send varchar2(50) := '"Automail" <[email protected]>';
rcpt varchar2(50) := '"systems" <[email protected]>';
sub  varchar2(50) := 'MSMEDA';
mtyp varchar2(50) := 'multipart/mixed';
prty pls_integer := 1;
d varchar2(50) := 'Hello world';
c utl_smtp.connection;
Begin
c := demo_mail.begin_mail(send,rcpt,sub,mtyp,prty);
demo_mail.begin_attachment(c,mtyp,true,'c:/kernel.txt',f);
demo_mail.End_attachment(c,true);
demo_mail.End_mail(c);
end;but i getting following error
Declare
ERROR at line 1:
ORA-29279: SMTP permanent error: 550 Sender verify failed
ORA-06512: at "SYS.UTL_SMTP", line 17
ORA-06512: at "SYS.UTL_SMTP", line 98
ORA-06512: at "SYS.UTL_SMTP", line 240
ORA-06512: at "ACCL.DEMO_MAIL", line 262
ORA-06512: at "ACCL.DEMO_MAIL", line 119
ORA-06512: at line 10 please help to solve this issue.
thx
kanish

Hi,
You seem to face smtp configuration problem.
Please check the below link where Tom has explained similar errors.
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::NO::P11_QUESTION_ID:255615160805
Hope it helps you,
Twinkle

Similar Messages

  • UTL_SMTP Attachment Issue

    I have a PL/SQL package which utilizes UTL_SMTP that has been deployed to 2 Dev instances. When the package gets called In one Dev instance the e-mail gets delivered successfully with an attached file and in the other Dev instance the attachment get imbedded in the message body. The recipient is the same in both cases as is the attached file and both instances reside on the same HP-UX box. What would cause the email to be attached correctly in one instance and not in the other?
    Here are samples of the email headers for both.
    E-mail File attached correctly
    =========================
    Microsoft Mail Internet Headers Version 2.0
    Received: from xmail.xxxx.com ([10.130.2.60]) by xxxxx.xx.xxxx.com with Microsoft SMTPSVC(6.0.3790.1830);
         Thu, 22 Feb 2007 11:09:54 -0500
    From: Oracle Applications [DEV3]
    To:<[email protected]>
    Reply-To: [email protected]
    Subject: xxxxxxxx complete
    Mime-Version: 1.0
    Content-Type: multipart/mixed; boundary="DMW.Boundary.605592468"
    Return-Path: [email protected]
    Message-ID: <[email protected]>
    X-OriginalArrivalTime: 22 Feb 2007 16:09:54.0367 (UTC) FILETIME=[E3B6B4F0:01C7569B]
    Date: 22 Feb 2007 11:09:54 -0500
    --DMW.Boundary.605592468
    Content-Type: text/html
    --DMW.Boundary.605592468
    Content-Type: application/octet-stream; name="6061675_log.txt"
    Content-Disposition: attachment; filename="6061675_log.txt"
    Content-Transfer-Encoding: 7bit
    DMW.Boundary.605592468
    E-mail File attached INCORRECTLY
    ============================
    Microsoft Mail Internet Headers Version 2.0
    Received: from xxxxxxx.xx.xxxx.com ([10.130.4.164]) by xxx.xx.xxxx.com with Microsoft SMTPSVC(6.0.3790.1830);
         Thu, 22 Feb 2007 11:09:24 -0500
    Received: from xmail.xxxx.com ([10.130.2.60]) by xxxxx.xx.xxxx.com with Microsoft SMTPSVC(6.0.3790.1830);
         Thu, 22 Feb 2007 11:09:23 -0500
    From: Oracle Applications [DEV5]
    To:<[email protected]>
    Reply-To: [email protected]
    Subject: Iron - AP Austin Tetra Vendor Process Complete
    Body of incorrect e-mail attachment
    ===========================
    Mime-Version: 1.0
    Content-Type: multipart/mixed; boundary="DMW.Boundary.605592468"
    Return-Path: [email protected]
    Message-ID: <[email protected]>
    X-OriginalArrivalTime: 22 Feb 2007 17:47:37.0552 (UTC) FILETIME=[8A71BD00:01C756A9]
    Date: 22 Feb 2007 12:47:37 -0500
    --DMW.Boundary.605592468
    Content-Type: text/html
    This email may contain up to 3 attached files.<BR><BR>
    Examples:
    <table>
    <tr>
    <td> 6042773_log.txt </td>
    <td>- This is the main concurrent program log file (always attached to email)</td> </tr> <tr> <td>6042773_out.csv</td>
    <td>- This is the main concurrent program output file (attached only when exceptions)</td> </tr> <tr> <td>ATIM%_20070104090122.log</td>
    <td>- This is the log file for Phase 1, Load Data File(attached only when load exceptions)</td> </tr> </table> <BR> If there is an attached CSV file, it will contain exception detail from any processing phase along with error messages. Exceptions contained in this file are in the same file format as the load file with extra informational fields at the end of each record. The exceptions in this file are formatted conveniently so they can be used to recontruct a new load file."
    <br><br><br><br><br><style type="text/css">
                             #note{
                             float:left;
                             width:100%;
                             height: 10px;
                             border: 2px solid black;
                             padding: 1px;
                             padding-left: 1px;
                             background-color: #AAAAAA;
                             font-size: 12;
                   </style>     <div id=note>This email was automatically generated from the Oracle E-Business Suite. Please contact Systems Support at 1-888-9999 or <A HREF=mailto:[email protected]>[email protected]</a> is you have encountered any issues with this email. Please reference the following:
    <br>
    <li>Instance: DEV5
    <li>Request Id: 123456
    <li>Concurrent Program Name: test
    <li>Source Code: iron_ap_at_vendor_load.process <li>Body Message Name: xxxx_AP_AT_LOAD_EMAIL_MESSAGE <li>Subject Message Name: xxxx_AP_AT_LOAD_EMAIL_SUBJECT
    --DMW.Boundary.605592468
    Content-Type: application/octet-stream; name="6061675_log.txt"
    Content-Disposition: attachment; filename="6061675_log.txt"
    Content-Transfer-Encoding: 7bit
    Thanks,
    Paul

    Could you post the code which you are using to send the mail. I need to send mail from a oracle procedure. I posted a thread with subject "sending mail from oracle procedure".
    Many thanks in advance.

  • UTL_SMTP Encoding Issue

    I've written a PL/SQL package for emailing.
    The issue that I'm having is that the final encoded stream has extra characters ( exclamation mark + new line + space ) "randomly" scattered throughout it.
    If the email is plain-text, it's not a big deal, it just looks messy and unprofessional.
    However, when sending HTML formatted emails, those extra characters can break HTML tag logic and thus, visually, hide some data/text.
    This package allows for the creation of nicely formatted HTML alert emails which have a common look-and-feel.
    However, when I view the email in my email viewer (+MS Outlook 2007+), there are additional characters inserted in the email source. However, if I user DBMS_OUTPUT.PUT_LINE( ... ) to view the dynamically created HTML code, created at run-time, it's clean.
    I had previously created a similar process in UNIX Shell Script and a 2nd in webMethods.
    The webMethods version also had some issues with the encoding (+we had to use base64 encoding to fix that+), however using base64 didn't fix the issue that I'm having in ORACLE.
    My package code can be found at:
    [http://www.mediafire.com/?sharekey=5b5b57bc23b48b866e7203eb87368129f0607387acaaf72db99f3f1679ee9294]
    Any help would be greatly appreciated.
    To reproduce my issues:
    BEGIN
    WM_EMAIL_HANDLER.SEND_ALERT ( in_processName => 'Test Maker',
    in_msg => 'Something gone done broke. You''d better fix it.',
    in_subject_msg => 'Something Broke',
    in_threatLevel => 5,
    in_to => WM_EMAIL_HANDLER.ARRAY( '[email protected]' ),
    in_from => '[email protected]',
    in_fromName => 'Oracle Database Account <[email protected]>',
    in_smtp_hostname => 'yourMailHost',
    in_smtp_portnum => 'yourMailHostPort' );
    END;
    Extra Info:
    <ul>
    <li>Oracle 10g running on Solaris UNIX</li>
    <li>MS Exchange Server is our MAIL server</li>
    <li>We're using mail host port 25</li>
    </ul>

    Could you post the code which you are using to send the mail. I need to send mail from a oracle procedure. I posted a thread with subject "sending mail from oracle procedure".
    Many thanks in advance.

  • Random new line issue in email attachment using utl_smtp need your help.

    Hi
    I am getting one problem unable to solve, need your help.
    I am creating one csv attachment in email using utl_smtp.
    but there are random newline in the attachment value so the csv getting corrupted.
    following is the attachment code
    FOR C2 IN CUR_VALIDATION_ERROR
                 LOOP
                   IF CUR_VALIDATION_ERROR%ROWCOUNT = 1 THEN
                     UTL_SMTP.write_data(l_mail_conn,'"LOG DATE","DATA ERROR IDENTIFIER","EMPLOYEE ID","SOURCE SYSTEM","SOURCE FILE ROW","ERROR LEVEL","ERROR MESSAGE"'||CHR(13));
                   END IF; 
                   UTL_SMTP.write_data(l_mail_conn,
                                                     chr(34)||C2.LOG_DT||chr(34)||chr(44)||
                                                     chr(34)||C2.DATA_ERR_ID||chr(34)||chr(44)||
                                                     chr(34)||C2.EMPE_ID||chr(34)||chr(44)||
                                                     chr(34)||C2.SOURCE||chr(34)||chr(44)||
                                                     chr(34)||C2.SOURCE_ROW||chr(34)||chr(44)||
                                                     chr(34)||C2.ERROR_LEVEL||chr(34)||chr(44)||
                                                     chr(34)||C2.ERR_MSG_DSCR||chr(34)||
                                                     CHR(13));
                 END LOOP;

    Thank you hm, but that is not the case, bcz I found newline character inside a sequence number. Its not possible to have newline character inside a sequence number
    "LOG DATE","DATA ERROR IDENTIFIER","EMPLOYEE ID","SOURCE SYSTEM","SOURCE FILE ROW","ERROR LEVEL","ERROR MESSAGE"
    "02-MAY-2012","7893660","123","XYZ","44952","WARNING","[02-MAY-12] - The value in field [PHONE]"
    "02-MAY-2012","7893663","12
    4","XYZ","52382","WARNING","[02-MAY-12] - The value in field [ADDRESS]"

  • 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

  • Sending email to multiple address using Utl_Smtp

    Hi,
    I want to send email to multiple address using the Utl_Smtp feature.
    When I am sending email to one email address in the To:Field it works fine.However, when I send
    to multiple address I am getting the below error.I am using a table(Email_test) to store all email id.
    Error report:
    ORA-29279: SMTP permanent error: 501 5.1.3 Invalid address
    ORA-06512: at "SYS.UTL_SMTP", line 20
    ORA-06512: at "SYS.UTL_SMTP", line 98
    ORA-06512: at "SYS.UTL_SMTP", line 240
    ORA-06512: at line 48
    29279. 00000 - "SMTP permanent error: %s"
    *Cause:    A SMTP permanent error occurred.
    *Action:   Correct the error and retry the SMTP operation.
    I am trying two options both ways I am getting error
    Option 1:
    Selecting two email id indivually in the select query as below
    select email into v_Recipient1 from Email_test where Key_name='U1';
    select email into v_Recipient2 from Email_test where Key_name='U2';
    v_Recipient := v_Recipient1||';'||v_Recipient2;
    Option 2:
    Is there a way to use option
    select email into v_Recipient1 from Email_test where Key_name='U4';
    ===========================================================
    Create table Script
    ===========================================================
    create table Email_test (Email varchar2(100),Key_name varchar2(10));
    insert into Email_test values ('[email protected]','U1');
    insert into Email_test values ('[email protected]','U2');
    insert into Email_test values ('[email protected]','U3')
    insert into Email_test values ('[email protected];[email protected];[email protected]','U4');
    select * from Email_test
    [email protected]                         U1
    [email protected]                         U2
    [email protected]                         U3
    [email protected];[email protected];[email protected]     U4
    select * from Email_test where Key_name in ('U1','U2','U3')
    [email protected]     U1
    [email protected]     U2
    [email protected]     U3
    select * from Email_test where Key_name='U4'
    [email protected];[email protected];[email protected]
    =======================================================
    PL/SQL Block
    ===========================================================
    declare
    v_From VARCHAR2(80) := '[email protected]';
    v_cc VARCHAR2(80);
    v_Recipient VARCHAR2(80) ;
    v_Recipient1 VARCHAR2(80) ;
    v_Recipient2 VARCHAR2(80) ;
    v_Subject VARCHAR2(80);
    v_Mail_Host VARCHAR2(50);
    v_Mail_Conn utl_smtp.Connection;
    crlf VARCHAR2(2) := chr(13)||chr(10);
    begin
    --Mail Host name
    select VALUE into v_Mail_Host from Server_info where server_name = 'SMTPServer';
    select email into v_Recipient1 from Email_test where Key_name='U1';
    select email into v_Recipient2 from Email_test where Key_name='U2';
    v_Recipient := v_Recipient1||';'||v_Recipient2;
    --for CC
    select email into v_cc from Email_test where Key_name='U3';
    v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host, 25);
    utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
    utl_smtp.Mail(v_Mail_Conn, v_From);
    utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
    utl_smtp.Rcpt(v_Mail_Conn, v_cc); -- To CC recepient
    utl_smtp.Rcpt(v_Mail_Conn, v_BCC); To BCC recepient
    utl_smtp.Data(v_Mail_Conn,
    'Date: ' || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf ||
    'From: ' || v_From || crlf ||
    'Subject: '|| v_Subject || crlf ||
    'To: ' || v_Recipient || crlf ||
    'Cc: ' || v_cc || crlf ||
    'Content-Type: text/html;' ||crlf ||
    --'Hello this is a test email');
    crlf || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf );
    utl_smtp.Quit(v_mail_conn);
    end;
    Any suggestion how to approach this issue.
    Thank you

    Simple Mail Transfer Protocol RFC 5321 specifications.
          RCPT TO:<forward-path> [ SP <rcpt-parameters> ] <CRLF>
       The first or only argument to this command includes a forward-path
       (normally a mailbox and domain, always surrounded by "&gt;" and "&lt;"
       brackets) identifying one recipient.In other words, you can only define a SINGLE mailbox address at a time. Multiple addresses requires multiple repeats of this command verb, once per maibox.
    Do not confuse this and the To: tag line in the Mime header that contains a comma delimited list of recipients. That tag line can contain anything - it is not parsed, not checked, and not verified as matching the actual recipient mailboxes as specified via the RCPT TO verb.

  • Sending email using UTL_SMTP

    Dear experts,
    I am trying to send an email using UTL_SMTP (i switched from UTL_MAIL to UTL_SMTP since i need to send mails with large attachments - BLOB). I am using the demo_mail package given here:
    http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    While running the program I am getting an error message (from the error.log) saying:
    [Mon Aug 04 14:00:21 2008] [error] [client 192.168.0.7] mod_plsql: /ns/email_p.send HTTP-404 ORA-29279: SMTP permanent error: 530 5.7.0 Must issue a STARTTLS command first. 9sm12723808qbw.6\nORA-06512: at "SYS.UTL_SMTP", line 20\nORA-06512: at "SYS.UTL_SMTP", line 98\nORA-06512: at "SYS.UTL_SMTP", line 221\nORA-06512: at "NEXTSTEP.SEND_EMAIL_HELPER", line 258\nORA-06512: at "NEXTSTEP.SEND_EMAIL_HELPER", line 119\nORA-06512: at "NEXTSTEP.EMAIL_P", line 33\nORA-06512: at line 31\n, referer: file:///C:/Documents and Settings/Mayank/My Documents/Flex Builder 3/ns5/bin-debug/main.swf
    My code is as follows:
    PACKAGE DECLARATION. This is the DEMO_MAIL package posted under above link (I have renamed it).
    CREATE OR REPLACE PACKAGE NEXTSTEP.send_email_helper IS
      ----------------------- Customizable Section -----------------------
      -- Customize the SMTP host, port and your domain name below.
        smtp_host   VARCHAR2(256) := 'smtp.gmail.com';
        smtp_port   PLS_INTEGER   := 587;
        smtp_domain VARCHAR2(256) := null;
      -- Customize the signature that will appear in the email's MIME header.
      -- Useful for versioning.
      MAILER_ID   CONSTANT VARCHAR2(256) := 'Mailer by Oracle UTL_SMTP';
      --------------------- End Customizable Section ---------------------
      -- A unique string that demarcates boundaries of parts in a multi-part email
      -- The string should not appear inside the body of any part of the email.
      -- Customize this if needed or generate this randomly dynamically.
      BOUNDARY        CONSTANT VARCHAR2(256) := '-----7D81B75CCC90D2974F7A1CBD';
      FIRST_BOUNDARY  CONSTANT VARCHAR2(256) := '--' || BOUNDARY || utl_tcp.CRLF;
      LAST_BOUNDARY   CONSTANT VARCHAR2(256) := '--' || BOUNDARY || '--' ||
                                                  utl_tcp.CRLF;
      -- A MIME type that denotes multi-part email (MIME) messages.
      MULTIPART_MIME_TYPE CONSTANT VARCHAR2(256) := 'multipart/mixed; boundary="'||
                                                      BOUNDARY || '"';
      MAX_BASE64_LINE_WIDTH CONSTANT PLS_INTEGER   := 76 / 4 * 3;
      -- A simple email API for sending email in plain text in a single call.
      -- The format of an email address is one of these:
      --   someone@some-domain
      --   "Someone at some domain" <someone@some-domain>
      --   Someone at some domain <someone@some-domain>
      -- The recipients is a list of email addresses  separated by
      -- either a "," or a ";"
      PROCEDURE mail(sender     IN VARCHAR2,
             recipients IN VARCHAR2,
             subject    IN VARCHAR2,
             message    IN VARCHAR2);
      -- Extended email API to send email in HTML or plain text with no size limit.
      -- First, begin the email by begin_mail(). Then, call write_text() repeatedly
      -- to send email in ASCII piece-by-piece. Or, call write_mb_text() to send
      -- email in non-ASCII or multi-byte character set. End the email with
      -- end_mail().
      FUNCTION begin_mail(sender     IN VARCHAR2,
                  recipients IN VARCHAR2,
                  subject    IN VARCHAR2,
                  mime_type  IN VARCHAR2    DEFAULT 'text/plain',
                  priority   IN PLS_INTEGER DEFAULT NULL)
                  RETURN utl_smtp.connection;
      -- Write email body in ASCII
      PROCEDURE write_text(conn    IN OUT NOCOPY utl_smtp.connection,
                   message IN VARCHAR2);
      -- Write email body in non-ASCII (including multi-byte). The email body
      -- will be sent in the database character set.
      PROCEDURE write_mb_text(conn    IN OUT NOCOPY utl_smtp.connection,
                  message IN            VARCHAR2);
      -- Write email body in binary
      PROCEDURE write_raw(conn    IN OUT NOCOPY utl_smtp.connection,
                  message IN RAW);
      -- APIs to send email with attachments. Attachments are sent by sending
      -- emails in "multipart/mixed" MIME format. Specify that MIME format when
      -- beginning an email with begin_mail().
      -- Send a single text attachment.
      PROCEDURE attach_text(conn         IN OUT NOCOPY utl_smtp.connection,
                data         IN VARCHAR2,
                mime_type    IN VARCHAR2 DEFAULT 'text/plain',
                inline       IN BOOLEAN  DEFAULT TRUE,
                filename     IN VARCHAR2 DEFAULT NULL,
                    last         IN BOOLEAN  DEFAULT FALSE);
      -- Send a binary attachment. The attachment will be encoded in Base-64
      -- encoding format.
      PROCEDURE attach_base64(conn         IN OUT NOCOPY utl_smtp.connection,
                  data         IN RAW,
                  mime_type    IN VARCHAR2 DEFAULT 'application/octet',
                  inline       IN BOOLEAN  DEFAULT TRUE,
                  filename     IN VARCHAR2 DEFAULT NULL,
                  last         IN BOOLEAN  DEFAULT FALSE);
      -- Send an attachment with no size limit. First, begin the attachment
      -- with begin_attachment(). Then, call write_text repeatedly to send
      -- the attachment piece-by-piece. If the attachment is text-based but
      -- in non-ASCII or multi-byte character set, use write_mb_text() instead.
      -- To send binary attachment, the binary content should first be
      -- encoded in Base-64 encoding format using the demo package for 8i,
      -- or the native one in 9i. End the attachment with end_attachment.
      PROCEDURE begin_attachment(conn         IN OUT NOCOPY utl_smtp.connection,
                     mime_type    IN VARCHAR2 DEFAULT 'text/plain',
                     inline       IN BOOLEAN  DEFAULT TRUE,
                     filename     IN VARCHAR2 DEFAULT NULL,
                     transfer_enc IN VARCHAR2 DEFAULT NULL);
      -- End the attachment.
      PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                   last IN BOOLEAN DEFAULT FALSE);
      -- End the email.
      PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection);
      -- Extended email API to send multiple emails in a session for better
      -- performance. First, begin an email session with begin_session.
      -- Then, begin each email with a session by calling begin_mail_in_session
      -- instead of begin_mail. End the email with end_mail_in_session instead
      -- of end_mail. End the email session by end_session.
      FUNCTION begin_session RETURN utl_smtp.connection;
      -- Begin an email in a session.
      PROCEDURE begin_mail_in_session(conn       IN OUT NOCOPY utl_smtp.connection,
                      sender     IN VARCHAR2,
                      recipients IN VARCHAR2,
                      subject    IN VARCHAR2,
                      mime_type  IN VARCHAR2  DEFAULT 'text/plain',
                      priority   IN PLS_INTEGER DEFAULT NULL);
      -- End an email in a session.
      PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection);
      -- End an email session.
      PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection);
    END;How should I solve the above error? Can anyone help me with my query please?
    If I add the code to start TLS it still gives me an error. If I add the code
    utl_smtp.command(conn,'STARTTLS');
    utl_smtp.helo(conn, smtp_domain);
    under email_sender_help package just before under begin_session function, it gives me an error saying:
    ORA-29279: SMTP permanent error: 503 5.5.1 EHLO/HELO first. s27sm2097329qbs.12
    So then if i enter the same code after:
    utl_smtp.command(conn,'STARTTLS');
    utl_smtp.helo(conn, smtp_domain);
    It gives me an error:
    ORA-29278: SMTP transient error: 421 Service not available
    Message was edited by:
    Monk
    Message was edited by:
    Monk

    look like rely turned off on the server..
    check this.. or ask your network guys..
    Go to Control Panel->Add or Remove Programs->Click on
    Add/Remove Wndows Components
    Check IIS check box.
    Select Internet Information Service (IIS) option and click on Details button
    Check whether SMTP Service is checked or not.
    If not selected then select SMTP check box.
    This process should be done on server.
    It will help out from ORA-29278: SMTP transient error: 421 Service not available problem.
    thanks

  • UTL_SMTP - Error while using Cc

    Hi All,
    I have got a issue regarding sending mails via pl/sql. Unable to add an mail id using Cc. The procedure looks something like this.
    CREATE OR REPLACE PROCEDURE test_mail is
    mailhost VARCHAR2(100) := 'GASVREXC01';
    conn UTL_SMTP.CONNECTION;
    crlf VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );
    mesg VARCHAR2( 1000 );
    BEGIN
    conn:= utl_smtp.open_connection( mailhost, 25 );
    utl_smtp.helo( conn, mailhost );
    utl_smtp.mail( conn, '[email protected]' );
    utl_smtp.rcpt( conn, '<[email protected]>' );
    utl_smtp.rcpt( conn, 'Cc:[email protected]' );
    mesg:= 'Date: ' || TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || crlf ||
    'From: User1 <[email protected]>' || crlf ||
    'Subject: Just testing' || crlf ||
    'To: Biju Varghese <[email protected]>' || crlf ||
    'Cc: Biju <[email protected]>' || crlf ||
    '' || crlf ||
    ' This is just a test, please disregard. ' || crlf ||
    utl_smtp.data( conn, mesg );
    utl_smtp.quit( conn );
    EXCEPTION
    WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
    utl_smtp.quit(conn);
    raise_application_error(-20000,
    'Failed tosend mail due to the following error: ' || sqlerrm);
    WHEN OTHERS THEN
    raise_application_error(-20001,
    'The following error has occured: ' || sqlerrm);
    END;
    Procedure created.
    SQL> execute test_mail;
    BEGIN test_mail; END;
    ERROR at line 1:
    ORA-20000: Failed tosend mail due to the following error: ORA-29279: SMTP
    permanent error: 553 malformed address: bcc:[email protected]
    ORA-06512: at "SYS.TEST_MAIL", line 28
    ORA-06512: at line 1
    Can someone help me out, as how can i use a Cc feature. We are using Microsoft Outlook. If i comment the line for Cc it works fine. Any help would be gr8
    Thanks
    Biju

    Can you back that statement about an Oracle UTL_SMTP bug up with an actual bug number??
    From what you have posted, this is not a bug!! but expected and documented (RFC'ed) SMTP server behaviour.
    My proof:
    /home/billy> telnet mail 25
    Trying 165.143.128.26...
    Connected to mail
    Escape character is '^]'.
    220 CNTRRA20-GTW01 [CNTRRA20-GTW01] Thu, 06 Mar 2008 14:26:26 +0200
    HELO 10.251.93.58
    250 CNTRRA20-GTW01 Hello [10.251.93.58]
    MAIL FROM: naveen <[email protected]>
    501 naveen <[email protected]> : illegal character(s) in domain string
    MAIL FROM: NAVEEN
    501 NAVEEN : domain string is NULL.
    quit
    221 CNTRRA20-GTW01 closing connection. Goodbye!
    Connection closed by foreign host.
    /home/billy>
    As you can clearly see, the SMTP server expects a DOMAIN name as part of the MAIL FROM address. It also does not accept the alternative format suggested.
    Yes, not all SMTP servers are equal and some support additional formatting.
    But to imply that because the SMTP server does not accept your address formatted as string NAVEEN, it is a UTL_SMTP problem, sounds like a smelly one to me.

  • 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

  • XDB Deinstall and install issue in 11gR1 Db and R12.1.2 Apps

    We have an issue with UTL_SMTP package. Whenever we are trying to access it through Ora-00600. I got one note 742014.1 and followed that. It worked for us and we are able to use the package without any issue. Now the problem is we have 150 + invalids in Apps schema, not sure how to resolve this. Doc doesn't say anything to do under apps schema.
    APPS schedulerRule913_TAB$xd TRIGGER
    APPS wtpParameters912_TAB TABLE
    APPS SYS_NTfSGaDiv3TiPgRAAhKBTj3g== TABLE
    APPS wtpParameters912_TAB$xd TRIGGER
    APPS window910_TAB TABLE
    APPS window910_TAB$xd TRIGGER
    APPS costParameters907_TAB TABLE
    APPS costParameters907_TAB$xd TRIGGER
    APPS cpDeferSameSite906_TAB TABLE
    APPS cpDeferSameSite906_TAB$xd TRIGGER
    APPS cpTravelPerUnitDu905_TAB TABLE
    APPS cpTravelPerUnitDu905_TAB$xd TRIGGER
    APPS cpTravelPerUnitDi904_TAB TABLE
    APPS cpTravelPerUnitDi904_TAB$xd TRIGGER
    APPS cpStandbyShiftUsage903_TAB TABLE
    APPS cpStandbyShiftUsage903_TAB$xd TRIGGER
    APPS cpResSkillLevel902_TAB TABLE
    APPS cpResSkillLevel902_TAB$xd TRIGGER
    APPS cpResAssignedNotPref901_TAB TABLE
    APPS cpResAssignedNotPref901_TAB$xd TRIGGER
    APPS cpResPerMinOvertime900_TAB TABLE
    APPS cpResPerMinOvertime900_TAB$xd TRIGGER
    APPS cpPartsViolation899_TAB TABLE
    APPS cpPartsViolation899_TAB$xd TRIGGER
    APPS cpTlsPerChildExtra898_TAB TABLE
    APPS cpTlsPerChildExtra898_TAB$xd TRIGGER
    APPS cpTlsPerDayExtra897_TAB TABLE
    APPS cpTlsPerDayExtra897_TAB$xd TRIGGER
    APPS cpTaskPerMinLate896_TAB TABLE
    APPS cpTaskPerMinLate896_TAB$xd TRIGGER
    APPS cpTaskPerMinEarly895_TAB TABLE
    APPS cpTaskPerMinEarly895_TAB$xd TRIGGER
    APPS cpTaskPerDayDelayed894_TAB TABLE
    APPS cpTaskPerDayDelayed894_TAB$xd TRIGGER
    APPS routerConfig892_TAB TABLE
    APPS routerConfig892_TAB$xd TRIGGER
    APPS rcEstimateThirdAv891_TAB TABLE
    APPS rcEstimateThirdAv891_TAB$xd TRIGGER
    APPS rcEstimateSecondA890_TAB TABLE
    APPS rcEstimateSecondA890_TAB$xd TRIGGER
    APPS rcEstimateFirstAv889_TAB TABLE
    APPS rcEstimateFirstAv889_TAB$xd TRIGGER
    APPS rcEstimateSecondB888_TAB TABLE
    APPS rcEstimateSecondB888_TAB$xd TRIGGER
    APPS rcEstimateFirstBo887_TAB TABLE
    APPS rcEstimateFirstBo887_TAB$xd TRIGGER
    APPS rcRouteFuncDelay4886_TAB TABLE
    APPS rcRouteFuncDelay4886_TAB$xd TRIGGER
    APPS rcRouteFuncDelay3885_TAB TABLE
    APPS rcRouteFuncDelay3885_TAB$xd TRIGGER
    APPS rcRouteFuncDelay2884_TAB TABLE
    APPS rcRouteFuncDelay2884_TAB$xd TRIGGER
    APPS rcRouteFuncDelay1883_TAB TABLE
    APPS rcRouteFuncDelay1883_TAB$xd TRIGGER
    APPS rcRouteFuncDelay0882_TAB TABLE
    APPS rcRouteFuncDelay0882_TAB$xd TRIGGER
    APPS rcConsiderTollRoads881_TAB TABLE
    APPS rcConsiderTollRoads881_TAB$xd TRIGGER
    APPS rcRouterCalcType880_TAB TABLE
    APPS rcRouterCalcType880_TAB$xd TRIGGER
    APPS schedulerParameters878_TAB TABLE
    APPS schedulerParameters878_TAB$xd TRIGGER
    APPS spMaxDistToSkipActual877_TAB TABLE
    APPS spMaxDistToSkipActual87$xd1128 TRIGGER
    APPS spMaxDistanceInGroup876_TAB TABLE
    APPS spMaxDistanceInGroup876_TAB$xd TRIGGER
    APPS spDefaultTravelDu875_TAB TABLE
    APPS spDefaultTravelDu875_TAB$xd TRIGGER
    APPS spDefaultTravelDi874_TAB TABLE
    APPS spDefaultTravelDi874_TAB$xd TRIGGER
    APPS spDefaultRouterEn873_TAB TABLE
    APPS spDefaultRouterEn873_TAB$xd TRIGGER
    APPS spTravelTimeExtra872_TAB TABLE
    APPS spTravelTimeExtra872_TAB$xd TRIGGER
    APPS spRouterMode871_TAB TABLE
    APPS spRouterMode871_TAB$xd TRIGGER
    APPS spCommuteHomeEmpt870_TAB TABLE
    APPS spCommuteHomeEmpt870_TAB$xd TRIGGER
    APPS spCommuteExcludedTime869_TAB TABLE
    APPS spCommuteExcludedTime86$xd1153 TRIGGER
    APPS spCommutesPosition868_TAB TABLE
    APPS spCommutesPosition868_TAB$xd TRIGGER
    APPS spOptimizerSucces867_TAB TABLE
    APPS spOptimizerSucces867_TAB$xd TRIGGER
    APPS spForceOptimizerT866_TAB TABLE
    APPS spForceOptimizerT866_TAB$xd TRIGGER
    APPS spAutoRejectStsId865_TAB TABLE
    APPS spAutoRejectStsId865_TAB$xd TRIGGER
    APPS spAutoRejectStsId864_TAB TABLE
    APPS spAutoRejectStsId864_TAB$xd TRIGGER
    APPS spAutoSchDefaultQuery863_TAB TABLE
    APPS spAutoSchDefaultQuery86$xd1172 TRIGGER
    APPS spMaxOvertime862_TAB TABLE
    APPS spMaxOvertime862_TAB$xd TRIGGER
    APPS spMaxResources861_TAB TABLE
    APPS spMaxResources861_TAB$xd TRIGGER
    APPS spPickTerritoryRe860_TAB TABLE
    APPS spPickTerritoryRe860_TAB$xd TRIGGER
    APPS spPickSkilledReso859_TAB TABLE
    APPS spPickSkilledReso859_TAB$xd TRIGGER
    APPS spPickIbResources858_TAB TABLE
    APPS spPickIbResources858_TAB$xd TRIGGER
    APPS spPickContractRes857_TAB TABLE
    APPS spPickContractRes857_TAB$xd TRIGGER
    APPS spDistLastChildEffort856_TAB TABLE
    APPS spDistLastChildEffort85$xd1194 TRIGGER
    APPS spDefaultShiftDur855_TAB TABLE
    APPS spDefaultShiftDur855_TAB$xd TRIGGER
    APPS spMinTaskLength854_TAB TABLE
    APPS spMinTaskLength854_TAB$xd TRIGGER
    APPS spSparesSource853_TAB TABLE
    APPS spSparesSource853_TAB$xd TRIGGER
    APPS spSparesMandatory852_TAB TABLE
    APPS spSparesMandatory852_TAB$xd TRIGGER
    APPS spConsiderStandby851_TAB TABLE
    APPS spConsiderStandby851_TAB$xd TRIGGER
    APPS spEnforcePlanWindow850_TAB TABLE
    APPS spEnforcePlanWindow850_TAB$xd TRIGGER
    APPS spWtpThreshold849_TAB TABLE
    APPS spWtpThreshold849_TAB$xd TRIGGER
    APPS spMaxCalcTime848_TAB TABLE
    APPS spMaxCalcTime848_TAB$xd TRIGGER
    APPS spMaxPlanOptions847_TAB TABLE
    APPS spMaxPlanOptions847_TAB$xd TRIGGER
    APPS spPlanScope846_TAB TABLE
    APPS spPlanScope846_TAB$xd TRIGGER

    Hi;
    What is your EBS version and OS?
    What is exact ORA-600 error. This error is internal error which mean you should work wiht oracle support for this issue. But first please check below note
    Troubleshoot an ORA-600 or ORA-7445 Error Using the Error Lookup Tool [ID 153788.1]
    If its not help, i sugget log a SR
    Regard
    Helios

  • Utl_smtp   and  problem with french language characters

    Hello,
    I am using utl_smtp to send email.
    Here is part of the proc:
    First try:
    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.open_data(mail_conn);
    utl_smtp.write_data(mail_conn, 'MIME-Version: 1.0' ||CHR(13)||
    CHR(10)||'Content-Type: text/plain; charset=WE8ISO8859P1' ||
    CHR(13)||CHR(10)|| 'Content-Transfer-Encoding: 8bit' || CHR(13)||CHR(10) || message);
    utl_smtp.close_data(mail_conn);
    utl_smtp.quit(mail_conn);
    This gives the output:
    .... adresse par element X doit etre ....
    which is wrong. It should be:
    .... adressé par élément X doit être ....
    I then made the following modif:
    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.open_data(mail_conn);
    /*This is the modif */
    utl_smtp.write_data(mail_conn, 'MIME-version: 1.0' || utl_tcp.CRLF);
    utl_smtp.write_data(mail_conn, 'Content-Type: text/plain; charset=WE8ISO8859P1'||utl_tcp.CRLF);
    utl_smtp.write_data(mail_conn, 'Content-Transfer-Encoding: 8bit' ||utl_tcp.CRLF);
    utl_smtp.write_raw_data(mail_conn,utl_raw.cast_to_raw(utl_tcp.CRLF || message));
    /* end of modif */
    utl_smtp.close_data(mail_conn);
    utl_smtp.quit(mail_conn);
    This gives the output:
    FROM: [email protected]
    SUBJECT: Demande pour XYZ
    TO: [email protected]
    .... adressé par élément X doit être ....
    which is the intended result except for the FROM, SUBJECT and To.
    Of course, I can make that disappear by tweaking the modif. However, I want to know why the original procedure is not working even though I followed the utl_smtp specs.
    Note:
    message := '
    'FROM:'||V_SENDER||CHR(13)||CHR(10)||
                   'SUBJECT:'||Demande pour XYZ ' ||CHR(13)||CHR(10)||
                   'TO:'||V_COURRIEL||CHR(13)||CHR(10)||CHR(13)||CHR(10)||V_CORPS_MESSAGE;
    Database:
    NLS_CHARACTERSET : WE8ISO8859P1
    NLS_LANGUAGE : FRENCH
    NLS_NCHAR_CHARACTERSET : AL16UTF16
    Base : Oracle9i Release 9.0.1.3.0
    Thanks

    Hello,
    Issue was resolved.
    ==============================================
    PROCEDURE Send_Mail (sender IN VARCHAR2,recipient IN VARCHAR2,message IN VARCHAR2, myheader IN varchar2) IS
    mailhost VARCHAR2(50) :='mail.mystmpexample.com'; -- get host name;
    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.open_data(mail_conn);
    utl_smtp.write_data(mail_conn, myheader || CHR(13)||CHR(10));
    utl_smtp.write_data(mail_conn, 'MIME-version: 1.0' || CHR(13)||CHR(10));
    utl_smtp.write_data(mail_conn, 'Content-Type: text/plain; charset=WE8ISO8859P1'|| CHR(13)||CHR(10));
    utl_smtp.write_data(mail_conn, 'Content-Transfer-Encoding: 8bit' || CHR(13)||CHR(10));
    utl_smtp.write_data(mail_conn, CHR(13)||CHR(10));
    utl_smtp.write_raw_data(mail_conn,utl_raw.cast_to_raw(message));
    utl_smtp.close_data(mail_conn);
    utl_smtp.quit(mail_conn);
    EXCEPTION
    WHEN OTHERS THEN
    utl_smtp.quit(mail_conn);
    RAISE_APPLICATION_ERROR(-20000,'Impossible d''envoyer le courrier du a l''erreur suivante : ' || SQLERRM);
    END; -- procedure Send_Mail
    ==============================================
    Please note that the line:
    utl_smtp.write_data(mail_conn, CHR(13)||CHR(10));
    is vey important since it is going to separate the header from the message itself. This will allow the message to come out alone in the email.
    Variable myheader contains the From, To and Subject and each needs to be followed by CHR(13)||CHR(10
    Thanks

  • Arabic characters issue in smtp email csv attachment

    Hi all,
    the below email extracts the output of a query and sends it as an attachment in csv format.
    but the arabic characters are coming as question marks in the attachment, can someone kindly help, below is hte code
    procedure test   is
            smtp    UTL_SMTP.connection;
            reply   UTL_SMTP.reply;
                          csvContent      clob;---added
            procedure W( line varchar2 default null ) is
            begin
                    UTL_SMTP.write_data(
                            smtp,
                            line || utl_tcp.CRLF
            end;
    begin
            smtp := UTL_SMTP.open_connection('test.domain.com',25);
            --// IMPORTANT: specify the hostname of the plaform sending the mail!
            UTL_SMTP.helo( smtp,'test.domain.com');
            UTL_SMTP.mail( smtp,'[email protected]' );
           UTL_SMTP.rcpt( smtp,'[email protected]' );
            UTL_SMTP.open_data( smtp );
            --// mail header
            W( 'MIME-Version: 1.0' );
            W( 'Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C87DCB.CD85F300"');
            W( 'Subject: test' );
            W( 'From: test' );
            --// mail text body
            W();
            W( '------_=_NextPart_001_01C87DCB.CD85F300' );
            W( 'Content-Transfer-Encoding: 8bit' );
            W( 'Content-Type: text/plain' );
             W( 'Charset: AL32UTF8' );
             W();
            W( 'Dear All' );
            W();
            W( 'test' );
            W();
            --// mail attachment
            W();
            W( '------_=_NextPart_001_01C87DCB.CD85F300' );
            W( 'Content-Disposition: attachment; filename="test.csv"' );
            W( 'Content-Type: text/plain' );      
            W( 'Charset: AL32UTF8' );   
            W();
            W( 'EMPNO'||','||'ENAME       );
            for c in( SELECT EMPNO,ENAME FROM EMPLOYEES ) loop
                    W( c.EMPNO||','||c.ENAME  );
            end loop;
            W( '------_=_NextPart_001_01C87DCB.CD85F300' );
            UTL_SMTP.close_data( smtp );
            UTL_SMTP.quit( smtp );
    end;

    thanks srini, i am using microsoft excel,
    i think it is a character conversion issue, i had tested by sending the below message without charset=AL32UTF8 and arabic was displayed as junk, after giving the value of charset its working.
    begin
    utl_mail.send(
    sender => '[email protected]',
    recipients => '[email protected]',
    subject => 'Subject',
    message => 'إلاق فرع (ح',
    mime_type => 'text; charset=AL32UTF8');
    end;I think in the code i am not passing charset value correctly, can you kindly tell me where i can give the charset in the below code
    procedure test   is
            smtp    UTL_SMTP.connection;
            reply   UTL_SMTP.reply;
                          csvContent      clob;---added
            procedure W( line varchar2 default null ) is
            begin
                    UTL_SMTP.write_data(
                            smtp,
                            line || utl_tcp.CRLF
            end;
    begin
            smtp := UTL_SMTP.open_connection('test.domain.com',25);
            --// IMPORTANT: specify the hostname of the plaform sending the mail!
            UTL_SMTP.helo( smtp,'test.domain.com');
            UTL_SMTP.mail( smtp,'[email protected]' );
           UTL_SMTP.rcpt( smtp,'[email protected]' );
            UTL_SMTP.open_data( smtp );
            --// mail header
            W( 'MIME-Version: 1.0' );
            W( 'Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C87DCB.CD85F300"');
            W( 'Subject: test' );
            W( 'From: test' );
            --// mail text body
            W();
            W( '------_=_NextPart_001_01C87DCB.CD85F300' );
            W( 'Content-Transfer-Encoding: 8bit' );
            W( 'Content-Type: text/plain' );
             W( 'Charset: AL32UTF8' );
             W();
            W( 'Dear All' );
            W();
            W( 'test' );
            W();
            --// mail attachment
            W();
            W( '------_=_NextPart_001_01C87DCB.CD85F300' );
            W( 'Content-Disposition: attachment; filename="test.csv"' );
            W( 'Content-Type: text/plain' );      
            W( 'Charset: AL32UTF8' );   
            W();
            W( 'EMPNO'||','||'ENAME       );
            for c in( SELECT EMPNO,ENAME FROM EMPLOYEES ) loop
                    W( c.EMPNO||','||c.ENAME  );
            end loop;
            W( '------_=_NextPart_001_01C87DCB.CD85F300' );
            UTL_SMTP.close_data( smtp );
            UTL_SMTP.quit( smtp );
    end;

  • Sending PDF as attachment using utl_smtp

    Hi all,
    I am encountering the following problem when i try to send the email using utl_smtp builtin,i receive the mail in my outlook,but not able to read the contents of the pdf file.
    Oracle Version :- Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    source code:-
    CREATE OR REPLACE PROCEDURE "PROC_MAIL_ATTACH_PDFS" (
    p_cust_nb IN cstm.cstm_cust_nb%TYPE,
    from_name IN VARCHAR2,
    to_name IN VARCHAR2,
    subject IN VARCHAR2,
    MESSAGE IN VARCHAR2,
    p_binary_file IN VARCHAR2,
    p_seq_id IN NUMBER,
    p_ret_cd OUT NUMBER,
    p_ret_desc OUT VARCHAR2
    --ISO-8859-6
    IS
    v_smtp_server VARCHAR2 (100) := '172.20.204.17';
    --change this to your mail server
    v_smtp_server_port NUMBER := 25;
    v_directory_name VARCHAR2 (100);
    v_file_name VARCHAR2 (100);
    v_line VARCHAR2 (1000);
    crlf VARCHAR2 (2) := CHR (13)
    || CHR (10);
    mesg VARCHAR2 (32767);
    conn UTL_SMTP.connection;
    v_slash_pos NUMBER;
    v_file_handle UTL_FILE.file_type;
    invalid_path EXCEPTION;
    mesg_length_exceeded BOOLEAN := FALSE;
    l_msg VARCHAR2 (32000);
    l_tag_sep VARCHAR2 (1)
    := func_get_config_value ('TAGSEPRTR');
    l_ind VARCHAR2 (10);
    l_rec VARCHAR2 (4000);
    l_sep_rep VARCHAR2 (4000) := '17_ACCSTMT_NOV_2010';
    l_rem_rep VARCHAR2 (4000);
    l_rep VARCHAR2 (4000);
    l_mim_type VARCHAR2 (2000);
    boundary CONSTANT VARCHAR2 (256)
    := '-----DMW.Boundary.605592468';
    first_boundary CONSTANT VARCHAR2 (256) := '--' || boundary || crlf;
    last_boundary CONSTANT VARCHAR2 (256)
    := '--' || boundary || '--' || crlf;
    multipart_mime_type CONSTANT VARCHAR2 (256)
    := 'multipart/mixed; boundary="' || boundary || '"';
    mime_type VARCHAR2 (255) := 'text/html';
    l_offset NUMBER;
    l_ammount NUMBER;
    CURSOR cur_trnm
    IS
    SELECT trnm_email_enarr, trnm_email_anarr
    FROM trnm
    WHERE trnm_id = 16;
    l_enarr trnm.trnm_email_enarr%TYPE;
    l_anarr trnm.trnm_email_enarr%TYPE;
    l_message_body VARCHAR2 (32000);
    --// To check if all mails belongs to the customer already sent...
    CURSOR cur_pdfd
    IS
    SELECT COUNT (*)
    FROM pdfd
    WHERE pdfd_cust_nb = p_cust_nb
    AND pdfd_email_sts IS NULL
    --NEWLY ADDED ...
    AND NVL (pdfd_stmt_mode, '.') = 'E'
    AND TRUNC (pdfd_to_dt) = (SELECT MAX (TRUNC (pdfd_to_dt))
    FROM pdfd
    WHERE pdfd_cust_nb = p_cust_nb);
    l_cnt NUMBER := 0;
    PROCEDURE send_header (NAME IN VARCHAR2, header IN VARCHAR2)
    IS
    BEGIN
    UTL_SMTP.write_data (conn, NAME || ': ' || header || crlf);
    END;
    PROCEDURE write_raw (
    p_conn IN OUT NOCOPY UTL_SMTP.connection,
    p_message IN RAW
    IS
    BEGIN
    UTL_SMTP.write_raw_data (p_conn, p_message);
    END write_raw;
    PROCEDURE binary_attachment (
    p_conn IN OUT UTL_SMTP.connection,
    p_file_name IN VARCHAR2,
    p_mime_type IN VARCHAR2
    IS
    k_max_line_width CONSTANT PLS_INTEGER DEFAULT 54;
    v_amt BINARY_INTEGER := 672 * 3;
    /* ensures proper format; 2016 */
    v_bfile BFILE;
    v_file_len PLS_INTEGER;
    v_buf RAW (2100);
    v_buf1 RAW (2100);
    v_modulo PLS_INTEGER;
    v_pieces PLS_INTEGER;
    v_file_pos PLS_INTEGER := 1;
    v_data RAW (32767);
    v_data1 RAW (32767);
    v_chunks PLS_INTEGER;
    l_amt NUMBER := 32767;
    l_off NUMBER := 1;
    l_raw RAW (32767);
    l_raw1 RAW (32767);
    l_lob BLOB;
    l_lob_empt BLOB;
    req UTL_HTTP.req;
    resp UTL_HTTP.resp;
    resp_empt UTL_HTTP.resp;
    l_url VARCHAR2 (4000);
    l_rep_path VARCHAR2 (2000);
    l_report VARCHAR2 (100);
    l_seq_nb repq.repq_seq_nb%TYPE;
    l_parm repq.repq_parm_val%TYPE;
    l_repq repq%ROWTYPE;
    l_sts NUMBER;
    l_user VARCHAR2 (10);
    --L_MSG VARCHAR2(32000);
    l_seq_id NUMBER;
    usr_err EXCEPTION;
    --// 07-Jun-2009 - Basheer A.S. : Code added for sending A/c Statement and PFL statements in single e-mail ...
    CURSOR cur_pdfd
    IS
    SELECT
    --UTL_COMPRESS.LZ_UNCOMPRESS(PDFD_DB_FILE) PDFD_DB_FILE,
    pdfd_file_name
    FROM pdfd
    WHERE pdfd_cust_nb = p_cust_nb
    --AND PDFD_EMAIL_STS IS NULL
    --NEWLY ADDED ...
    --AND NVL(PDFD_STMT_MODE,'.') = 'E'
    AND pdfd_seq_nb = p_seq_id
    AND TRUNC (pdfd_to_dt) = (SELECT MAX (TRUNC (pdfd_to_dt))
    FROM pdfd
    WHERE pdfd_cust_nb = p_cust_nb);
    l_buffer_size INTEGER := 57;
    l_offset INTEGER := 1;
    l_raw RAW (57);
    l_file_nm pdfd.pdfd_file_name%TYPE;
    BEGIN
    --// 06-Jun-2009 - Basheer A.S. : Code added for sending A/c Statement and PFL statements in a single e-mail ...
    --// Initializing temporary CLOB data ...
    DBMS_LOB.createtemporary (l_lob, FALSE);
    --DBMS_LOB.createtemporary(L_LOB_EMPT, FALSE);
    --// Loop thro all the records for the given Customer Number...
    OPEN cur_pdfd;
    LOOP
    --FETCH CUR_PDFD INTO L_LOB, L_FILE_NM;
    FETCH cur_pdfd
    INTO --L_LOB_EMPT,
    l_file_nm;
    EXIT WHEN cur_pdfd%NOTFOUND;
    proc_audit_log ('T',
    'PROC_MAIL_ATTACH_PDFS, Customer No. '
    || p_cust_nb
    || ', File attachment: '
    || l_file_nm
    UTL_SMTP.write_data (conn, first_boundary);
    UTL_SMTP.write_data (conn,
    'Content-Transfer-Encoding: base64 '
    || UTL_TCP.crlf
    UTL_SMTP.write_data (conn,
    'Content-Type: ' || mime_type || UTL_TCP.crlf
    UTL_SMTP.write_data (conn,
    'Content-Disposition: ATTACHMENT; filename="'
    || p_file_name
    || '"'
    || UTL_TCP.crlf
    UTL_SMTP.write_data (conn, crlf);
    l_ind := '1.1';
    v_file_pos := 1;
    --// Attaching individual PDF files ...
    BEGIN
    v_modulo := 0;
    v_pieces := 0;
    v_amt := 2016;
    l_ind := '2.1';
    v_file_len := DBMS_LOB.getlength (l_lob);
    --v_file_len := dbms_lob.getlength(L_LOB_EMPT);
    v_modulo := MOD (v_file_len, v_amt);
    v_pieces := TRUNC (v_file_len / v_amt);
    IF (v_modulo <> 0)
    THEN
    v_pieces := v_pieces + 1;
    END IF;
    l_ind := '2.2';
    DBMS_LOB.READ (l_lob, v_amt, v_file_pos, v_buf);
    --dbms_lob.read(L_LOB_EMPT, v_amt, v_file_pos, v_buf);
    v_data := v_data1;
    v_chunks := 0;
    v_data := v_data1;
    FOR i IN 1 .. v_pieces
    LOOP
    v_file_pos := i * v_amt + 1;
    v_file_len := v_file_len - v_amt;
    v_data := UTL_RAW.CONCAT (v_data, v_buf);
    l_ind := '2.3';
    v_chunks := TRUNC (UTL_RAW.LENGTH (v_data) / k_max_line_width);
    IF (i <> v_pieces)
    THEN
    v_chunks := v_chunks - 1;
    END IF;
    l_ind := '2.4';
    write_raw (p_conn => p_conn,
    p_message => UTL_ENCODE.base64_encode (v_data)
    v_data := v_data1;
    IF (v_file_len < v_amt AND v_file_len > 0)
    THEN
    v_amt := v_file_len;
    END IF;
    l_ind := '2.5';
    DBMS_LOB.READ (l_lob, v_amt, v_file_pos, v_buf);
    --DBMS_LOB.READ(L_LOB_EMPT, v_amt, v_file_pos, v_buf);
    END LOOP;
    EXCEPTION
    WHEN OTHERS
    THEN
    proc_audit_log
    ('E',
    'PROC_MAIL_ATTACH_PDFS.binary_attachment.inside BLOB loop, :'
    || SQLERRM
    || ',ind:'
    || l_ind
    END;
    v_file_pos := 1;
    UTL_SMTP.write_data (conn, UTL_TCP.crlf);
    UTL_SMTP.write_data (conn, UTL_TCP.crlf);
    END LOOP;
    --// END multiple file attachments
    l_ind := '2.6';
    UTL_SMTP.write_data (p_conn, last_boundary || UTL_TCP.crlf);
    EXCEPTION
    WHEN OTHERS
    THEN
    proc_audit_log ('E',
    'PROC_MAIL_ATTACH_PDFS, when others:'
    || l_ind
    || ', '
    || SQLERRM
    END binary_attachment;
    BEGIN
    --// If no pending emails for the given Customer, then exit the process...
    OPEN cur_pdfd;
    FETCH cur_pdfd
    INTO l_cnt;
    CLOSE cur_pdfd;
    --// If still pending statements needs to be send...
    --IF L_CNT > 0 THEN
    IF l_cnt = 0
    THEN
    OPEN cur_trnm;
    FETCH cur_trnm
    INTO l_enarr, l_anarr;
    CLOSE cur_trnm;
    l_message_body :=
    '<html>'
    ||
    --'<meta http-equiv="Content-Type" content="text/html; charset=WINDOWS-1256(Arabic)">'||
    --'<meta http-equiv="Content-Type" content="text/html; charset=WINDOWS-1256">'||
    '<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-6">'
    || '<body>
    <TABLE BORDER="0" WIDTH=100% style="table-layout:fixed;">
    <TR>
    <TD WIDTH="50%" ALIGN="LEFT" style="word-wrap: break-word"><B>'
    || l_enarr
    || '</B></TD>'
    || '<TD WIDTH="50%" ALIGN="RIGHT" style="word-wrap: break-word"><B>'
    || l_anarr
    || '</B></TD></TR></TABLE>
    </body>
    </html>';
    proc_audit_log ('T', 'PROC_MAIL_ATTACH_PDFS, msg:' || l_msg);
    v_smtp_server := func_get_config_value ('MAILHOST');
    v_smtp_server_port := func_get_config_value ('MAILPORT');
    l_ind := '3.1';
    conn := UTL_SMTP.open_connection (v_smtp_server, v_smtp_server_port);
    --utl_smtp.helo( conn, v_smtp_server );
    --utl_smtp.mail( conn, '[email protected]' );
    UTL_SMTP.helo (conn, v_smtp_server);
    UTL_SMTP.mail (conn, from_name);
    UTL_SMTP.rcpt (conn, to_name);
    l_ind := '3.2';
    l_rec := func_eti_tagval (l_msg, 'EMAIL');
    proc_audit_log ('T', 'PROC_MAIL_ATTACH_PDFS, l_rec:' || l_rec);
    proc_audit_log ('T', 'l_sep_rep1' || l_sep_rep);
    UTL_SMTP.open_data (conn);
    send_header ('From', '<' || from_name || '>');
    send_header ('To', '<' || to_name || '>');
    --send_header('To',''||Func_Eti_Tagval(L_MSG, 'EMAIL')||'');
    send_header ('Date', TO_CHAR (SYSDATE, 'dd Mon yy hh24:mi:ss'));
    send_header ('Subject', subject);
    send_header ('Content-Type', multipart_mime_type);
    UTL_SMTP.write_data (conn, first_boundary);
    --utl_smtp.write_data(conn, 'Content-Type: '||mime_type||utl_tcp.crlf);
    --utl_smtp.write_data(conn, 'Content-Type: '||mime_type||'; charset=Windows-1256'||utl_tcp.crlf);
    UTL_SMTP.write_data (conn,
    'Content-Type: '
    || mime_type
    || '; charset=ISO-8859-6'
    || UTL_TCP.crlf
    --new...
    UTL_SMTP.write_data (conn, crlf);
    UTL_SMTP.write_raw_data (conn, UTL_RAW.cast_to_raw (l_message_body));
    UTL_SMTP.write_data (conn, crlf);
    UTL_SMTP.write_data (conn, crlf);
    proc_audit_log ('T', 'l_sep_rep2' || l_sep_rep);
    binary_attachment (p_conn => conn,
    p_file_name => l_sep_rep || '.pdf',
    p_mime_type => 'multipart/mixed'
    ); --||l_sep_rep||'.pdf');
    UTL_SMTP.write_data (conn, last_boundary || UTL_TCP.crlf);
    UTL_SMTP.close_data (conn);
    UTL_SMTP.quit (conn);
    END IF;
    p_ret_cd := 0;
    p_ret_desc := 'Mail sent successfully';
    EXCEPTION
    WHEN OTHERS
    THEN
    proc_audit_log ('E',
    'PROC_MAIL_ATTACH_PDFS, error:'
    || SQLERRM
    || 'ind:'
    || l_ind
    p_ret_cd := 1;
    END;
    Kindly help me to resolve this issue.
    Thanks & Regards
    Ariff

    pl ease check below link
    /people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface

  • Need Help about Utl_Smtp

    Dear All,
    We have oracle 10G R2 on windows.
    We have a procedure that sends mail from oracle. we are using outlook 2007.
    below is the code of mail Procedure which uses Utl_SMTP package.
    CREATE OR REPLACE PROCEDURE TEST_MAIL
       v_feed_number IN varchar2
    AS
       v_From       VARCHAR2(80) := '[email protected]';
       v_Recipient  VARCHAR2(80) := '[email protected]';
       v_Subject    VARCHAR2(80) := 'Conformation for ';
       v_Mail_Host  VARCHAR2(30) := 'I have Specified IP Address here';
       v_Mail_Conn  utl_smtp.Connection;
       crlf         VARCHAR2(2)  := chr(13)||chr(10);
       SERIAL_NO NUMBER := 1;
       v_mismatch_count NUMBER;
       v_cams_file_count NUMBER;
       CURSOR INS_UPD IS
        SELECT *
        FROM INSERT_UPDATE_RECORDS;
       CURSOR MIS IS
        SELECT A.FOLIONO,A.SCHEME_CODE,nvl(A.TOTAL_UNITS,0) "PROCESSED_TRAN_TOTAL_UNITS",
        nvl(B.TOTALUNITS,0) "SCHEMEWISE_TOTALUNIT",(nvl(A.TOTAL_UNITS,0) - nvl(B.TOTALUNITS,0)) "DIFFERENCE"
        FROM tran_temp_SPLIT A, CAMS_SCHEMEWISE_FOLIO B
        WHERE A.FOLIONO =B.FOLIONO (+)
        AND A.SCHEME_CODE = B.SCHCODE (+)
        AND round((nvl(A.TOTAL_UNITS,0) - nvl(B.TOTALUNITS,0)),3) <> 0;
      CURSOR ERROR_FILE IS
       SELECT FILE_NAME
       FROM INSERT_UPDATE_RECORDS
       WHERE DIFFERENCE <> 0;
      Cursor Error_code is select distinct COLUMN_VALUE,ERROR_MSG,TABLE_NAME from log_errors where error_date>Trunc(sysdate);
    BEGIN
      select count(*)
      into v_mismatch_count
      from(
             SELECT A.FOLIONO,A.SCHEME_CODE,nvl(A.TOTAL_UNITS,0) "PROCESSED_TRAN_TOTAL_UNITS",
                nvl(B.TOTALUNITS,0) "SCHEMEWISE_TOTALUNIT",(nvl(A.TOTAL_UNITS,0) - nvl(B.TOTALUNITS,0)) "DIFFERENCE"
                FROM tran_temp_SPLIT A, CAMS_SCHEMEWISE_FOLIO B
                WHERE A.FOLIONO =B.FOLIONO (+)
                AND A.SCHEME_CODE = B.SCHCODE (+)
                AND round((nvl(A.TOTAL_UNITS,0) - nvl(B.TOTALUNITS,0)),3) <> 0
      SELECT COUNT(*)
      INTO v_cams_file_count
      FROM CAMS_CHECKSUM_DBF;
      v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host);
      utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
      utl_smtp.Mail(v_Mail_Conn, v_From);
      utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
    --OPEN DATA CONNNECTION
      UTL_SMTP.OPEN_DATA(v_mail_conn);
    --MAIL HEADER
      utl_smtp.write_DATA(v_Mail_Conn,'Date: '   || to_char(sysdate, 'DD-MON-YYYY hh:mi:ss AM') || crlf);
      utl_smtp.write_DATA(v_Mail_Conn,'From: '   || v_From || crlf );
      utl_smtp.write_DATA(v_Mail_Conn,'Subject: '|| v_Subject || v_feed_number|| ' Mismatches:-'||v_mismatch_count||' Auto Generated Mail '||crlf);
      utl_smtp.write_DATA(v_Mail_Conn,'To: '     || v_Recipient || crlf);
    --MAIL BODY
      utl_smtp.write_DATA(v_Mail_Conn,'MIME-Version: 1.0'|| crlf );
      utl_smtp.write_DATA(v_Mail_Conn,'Content-Type: multipart/mixed;'|| crlf );
      utl_smtp.write_DATA(v_Mail_Conn,' boundary="-----SECBOUND"'|| crlf ||crlf );
      utl_smtp.write_DATA(v_Mail_Conn,'-------SECBOUND'|| crlf );
      utl_smtp.write_DATA(v_Mail_Conn,'Content-Type: text/plain;'|| crlf);
      utl_smtp.write_DATA(v_Mail_Conn,'Content-Transfer_Encoding: 7bit'|| crlf);
      utl_smtp.write_DATA(v_Mail_Conn,'Please the conformation file for '||v_feed_number||' attached. '|| crlf);
      utl_smtp.write_DATA(v_Mail_Conn,'There are '||v_mismatch_count||' Mismatches. '|| crlf);
      utl_smtp.write_DATA(v_Mail_Conn,null|| crlf);
      utl_smtp.write_DATA(v_Mail_Conn,null|| crlf);
      utl_smtp.write_DATA(v_Mail_Conn,null|| crlf);
      UTL_SMTP.WRITE_DATA(v_mail_conn, '-------SECBOUND' || crlf);
      UTL_SMTP.WRITE_DATA(v_mail_conn, 'Content-Type: text/plain;' || crlf);
    --MAIL ATACHMENT
        utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF || '-------SECBOUND');
        utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF ||'Content-Type: text/csv; ');
        utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF ||'Content-Disposition: attachment; filename="INSERT_UPDATE_P_'||v_feed_number||'.csv"');
        utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF ||'Content-Transfer-Encoding: 8bit');
        utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF);
        utl_smtp.write_data(v_Mail_Conn,utl_tcp.CRLF || 'AMC,This AMC');
        utl_smtp.write_data(v_Mail_Conn,utl_tcp.CRLF || 'Reference Number of Last Feed Updated,'||v_feed_number);
        utl_smtp.write_data(v_Mail_Conn,utl_tcp.CRLF || 'Confirmation Date and Time ,'||to_char(sysdate, 'DD-MON-YYYY hh:mi:ss AM'));
        utl_smtp.write_data(v_Mail_Conn,utl_tcp.CRLF || 'Confirmed By,Chanchal Wankhade(By Email)');
        utl_smtp.write_data(v_Mail_Conn,utl_tcp.CRLF || 'Details of Upload Confirmation');
        utl_smtp.write_data(v_Mail_Conn,utl_tcp.CRLF || 'Exceptions Noticed');
        utl_smtp.write_data(v_Mail_Conn,utl_tcp.CRLF || 'SNo,Feed file Name,No of Records Received from CAMS,Records inserted at AMC,Records updated at AMC,Records rejected by AMC,Records Failed,CAMS_CHECKSUM_RECORDS,dt_update');
      FOR cur_rec IN INS_UPD
        LOOP
         IF  cur_rec.CAMS_CHECKSUM_RECORDS IS NOT NULL AND  cur_rec.DIFFERENCE = 0 THEN
          utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF ||   SERIAL_NO                      || ',' ||
                                                 cur_rec.FILE_NAME              || ',' ||
                                                                cur_rec.TOTAL_RECORDS          || ',' ||
                                                                cur_rec. ROWS_INSERTED         || ',' ||
                                                                cur_rec.ROWS_UPDATED           || ',' ||
                                                                cur_rec.REJECTED_RECORDS       || ',' ||
                                                 cur_rec.DIFFERENCE             || ',' ||
                                                                cur_rec.CAMS_CHECKSUM_RECORDS  || ',' ||
                                                 cur_rec.DT_UPDATE);
          SERIAL_NO := SERIAL_NO+1;
             END IF;
    END LOOP;
       utl_smtp.write_DATA(v_Mail_Conn,null|| crlf);
       utl_smtp.write_DATA(v_Mail_Conn,' '|| crlf);
       utl_smtp.write_DATA(v_Mail_Conn,' '|| crlf);
    --MAIL ATACHMENT
        utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF || '-------SECBOUND');
        utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF ||'Content-Type: text/csv;');
        utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF ||'Content-Disposition: attachment; filename="'||sysdate||'_P_AFTER'||v_feed_number||'.csv"');
        utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF ||'Content-Transfer-Encoding: 8bit');
        utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF);
        utl_smtp.write_data(v_Mail_Conn,utl_tcp.CRLF || 'FOLIONO,SCHEME_CODE,PROCESSED_TRAN_TOTAL_UNITS,SCHEMEWISE_TOTALUNIT,DIFFERENCE');
      FOR cur_REC IN MIS
        LOOP
           utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF ||    CUR_REC.FOLIONO                                || ',' ||
                                                      CUR_REC.SCHEME_CODE                          || ',' ||
                                                   CUR_REC."PROCESSED_TRAN_TOTAL_UNITS"           || ',' ||
                                                                  CUR_REC."SCHEMEWISE_TOTALUNIT"                 || ',' ||
                                                                  CUR_REC. "DIFFERENCE"         );
       END LOOP;
      SERIAL_NO := SERIAL_NO-1;
    --MAIL BODY
      utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF || '-------SECBOUND');
      utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF || '-------SECBOUND');
      utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF ||'Content-Type: text/PLAIN;');
      utl_smtp.write_DATA(v_Mail_Conn,'Content-Transfer_Encoding: 7bit'|| crlf || crlf);
      utl_smtp.write_DATA(v_Mail_Conn,null|| crlf);
      utl_smtp.write_DATA(v_Mail_Conn,' '|| crlf);
      utl_smtp.write_DATA(v_Mail_Conn,' '|| crlf);
      utl_smtp.write_DATA(v_Mail_Conn,'The number of files recieved from CAMS is:- '||v_cams_file_count|| crlf);
      utl_smtp.write_DATA(v_Mail_Conn,'The number of files uploaded are:- '||SERIAL_NO|| crlf);
    IF  SERIAL_NO-v_cams_file_count = 0 THEN
    utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF ||'All files uploaded correctly ');
    ELSE
    FOR cur_REC IN ERROR_FILE
        LOOP
           utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF ||CUR_REC.FILE_NAME||' file not uploaded correctly.');
       END LOOP;
    FOR ERROR_COD IN ERROR_CODE
         LOOP
              utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF ||ERROR_COD.TABLE_NAME|| ' file not uploaded correctly. '||ERROR_COD.ERROR_MSG|| 'FOR  '||ERROR_COD.COLUMN_VALUE);
    END LOOP;
    END IF;
          utl_smtp.write_data(v_Mail_Conn, utl_tcp.CRLF ||'This mail is auto generated.');
    --CLOSE CONNECTION
      UTL_SMTP.CLOSE_DATA(v_mail_conn);
      utl_smtp.Quit(v_mail_conn);
    EXCEPTION
      WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
        raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
    END;Procedure is running fine. but the body of mail is comming in text attached file.
    How can i set it as genuen mail body in outlook 2007?
    Regards,
    Chanchal wankhade.

    Chanchal,
    Procedure is running fine. but the body of mail is comming in text attached file.
    How can i set it as genuen mail body in outlook 2007?I think what exactly is going on that you are getting the mail as attached text file, but can suggest you that don't touch the working procedure. You have following options :
    1.Just put comments (" -- ") at doubtful line and see, upto which line, procedure is running fine; i mean a kind of debugging.
    2.Just try to create another procedure, a simple one, code you can get from this forum and/or google by using send mail through utl_smtp.
    UTL_SMTP mail with attachment( Problem in attaching zip file)
    Re: Sending UTL_SMTP mail with single jpg attachment issue
    etc.
    Now compare between new and existing procedure closely. I am sure, you can get valuable clue. Why we can't answer you to the point, because we don't have configured SMTP, protocols, service provider's configurations, OS's settings etc.. same as you are having. So, I think you can play around debugging and a simple procedure either way.
    Regards
    Girish Sharma
    Edited by: Girish Sharma on Apr 5, 2012 4:50 PM
    Between, I found below link which may be helpful to you :
    Why is the mail body attached as text file using SMTP :
    http://stackoverflow.com/questions/2419963/sending-a-mailmessage-with-system-net-mail-smtpclient-why-is-the-mail-body-atta
    It is talking about MIME type "multi-part". Try to change it with another type.

  • 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à.

Maybe you are looking for

  • Why does iTunes ask for me to login when I start the Application?

    I used to never have to enter my password right off the bat when I opened the iTunes program. Did an update start requiring this or did I mess with the settings. I tried clicking on on my account and resetting the warnings, but that didn't help. I al

  • IOS 8 location services not working well on my iPhone 5 and no longer works on iPad 3 WiFi

    Is anyone having the same issues? when I use the MAPS app on my iPhone 5 it shows a wrong location and sometimes I'm in the MIDDLE OF ATLANTIC OCEAN. On my iPad 3 the location service arrow does not apear anymore and it was working fine in iOS 7.1.2.

  • Can't open previous project

    Haven't work on this project for about a month. Now when I try to open it I get Searching for movie data file .... Then I get another message Then movie data fileFinal mix dvd-00000103 cannot be found. without this file the movie cannot play properly

  • Unable to activate session in OSB

    Hi! I have some problems when i try to activate session on Oracle Service Bus. I just create session in new clear OSB, add new projest or new resource to default project and click "activate->submit" and get " [Deployer:149150]An IOException occurred

  • How to detach refresh button from address bar in the new UI of FF29?

    IN FF28 it was possible to detach the refresh button from the address bar, but now the whole address bar is just one element. I am really used to have the button on the left side and not on the right side of the screen. I would love to have the oppor