This discussion is archived
2 Replies Latest reply: Jan 13, 2012 3:50 AM by BillyVerreynne RSS

How to attach multiple files in UTL_MAIL.SEND_ATTACH_VARCHAR2 method

910815 Newbie
Currently Being Moderated
Hi all ,

I had written a pl/sql where it will write multiple csvs i.e. a.csv,b.csv,c.csv,d.csv to a location using UTL_FILE to reports folder .

How do i attach a.csv,b.csv,c.csv,d.csv into a single mail ??


UTL_MAIL.send_attach_raw (sender => 'sender@abc.com.sg',
recipients => 'recepient.com.sg',
subject => 'Reports',
MESSAGE => 'Reports are attached above',
mime_type => 'text/html; charset=UTF8',
attachment => a.csv,
att_inline => FALSE,
att_filename => file1
);

Edited by: 907812 on 12-Jan-2012 23:03

Edited by: 907812 on 12-Jan-2012 23:03

Edited by: 907812 on 12-Jan-2012 23:04

Edited by: 907812 on 12-Jan-2012 23:04
  • 1. Re: How to attach multiple files in UTL_MAIL.SEND_ATTACH_VARCHAR2 method
    BillyVerreynne Oracle ACE
    Currently Being Moderated
    UTL_MAIL does not work like that - you pointing to an external file and telling it to grab it and attached it to your e-mail.

    If you refer to the manual, the attachment parameter specifies it must contain the contents of the file.

    So your code needs to open the file. Your code needs to read the contents of the file. Your code needs to close the file. Your code needs to supply the contents text to UTL_MAIL via the attachment parameter.

    And as there is only a single attachment parameter, only a single file's contents can be supplied as attachment.

    Multiple attachments? Then you need to do what UTL_MAIL does. You need to write code that creates a valid e-mail Mime body. The Mime body must allow for multiple attachment. The Mime body needs to be delivered as an e-mail via the UTL_SMTP package.
  • 2. Re: How to attach multiple files in UTL_MAIL.SEND_ATTACH_VARCHAR2 method
    HamidHelal Guru
    Currently Being Moderated
    check this link

    http://saubbane.blogspot.com/2011/02/sending-multiple-attachment-blob-using.html

    hope this will help you

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points