Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Send OS File in email using UTL_MAIL

fperezhnJan 20 2010 — edited Feb 10 2010
I've been generating reports and delivering them through email using UTL_MAIL.SEND_ATTACH_VARCHAR. I build the entire HTML structure and send it. I started to receive errors regarding missing periods in my digits, so I decided to save this HTML string into a file and I do that superbly.

Now, that I wish to send this saved HTML file ('rep.html') saved in a local directory in my server I try and use the UTL_MAIL.SEND_ATTACH_RAW and I don't seem to be sending this mail with a html file as an attachment.

Current Code:

DECLARE

os_file UTL_FILE.FILE_TYPE;
virtual_dir VARCHAR2(30);
os_file_name VARCHAR2(20);

file_raw_mail RAW(32727);

BEGIN

virtual_dir := 'DIR_VIRT';
os_file_name := 'rep.html';

os_file := UTL_FILE.FOPEN(virtual_dir,os_file_name,'R');
UTL_FILE.GET_RAW(os_file,file_raw_mail,32727);

BEGIN

UTL_MAIL.SEND_ATTACH_RAW('somebody@mail.com',
*'someone@mail.com',*
NULL,
NULL,
*'Report',*
NULL,
*'text/plain; charset=iso-8859-1',*
*3,*
file_raw_mail,
TRUE,
*'text/html',*
*'report.html');*

END;

END;

In the attach_mime_type I've also used 'application/octet' and still I receive nothing.

The anonymous block completes itself successfully, and I receive no email.

HELP PLEASE!!!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 10 2010
Added on Jan 20 2010
8 comments
1,936 views