Home » SQL & PL/SQL » SQL & PL/SQL » UTL_MAIL Attachments (Oracle 10.2.0.2 Linus 64)
UTL_MAIL Attachments [message #283544] Tue, 27 November 2007 07:46 Go to next message
colesg
Messages: 11
Registered: October 2007
Location: London
Junior Member

Hi

Has anyone managed to send an attachment via UTL_MAIL which is bigger than 32k?

I am having an issue trying to achieve this.

Can anyone point me in the right direction please.

Cheers
Gary
Re: UTL_MAIL Attachments [message #283548 is a reply to message #283544] Tue, 27 November 2007 07:58 Go to previous messageGo to next message
Mohammad Taj
Messages: 2412
Registered: September 2006
Location: Dubai, UAE
Senior Member

How much you done, can you post here.
Re: UTL_MAIL Attachments [message #283555 is a reply to message #283544] Tue, 27 November 2007 08:08 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
http://asktom.oracle.com
Many examples of using UTL_MAIL (and correlated) with attachments in this site.

Regards
Michel
Re: UTL_MAIL Attachments [message #283579 is a reply to message #283544] Tue, 27 November 2007 09:12 Go to previous messageGo to next message
colesg
Messages: 11
Registered: October 2007
Location: London
Junior Member

Hi

I have managed to get files less than 32k in size to work, but cannot get anything any bigger to work using ATTACH_RAW or ATTACH_VARCHAR2

Here is what I have done.

declare
	v_utl_filehandler	UTL_FILE.FILE_TYPE;
   	v_rawfile			RAW(32767);
    v_size			 	NUMBER;
    v_block				NUMBER;
    v_boolean			BOOLEAN;
	v_file_dir			varchar2(100);
	v_file_name			varchar2(100) := 'EXT_GALA_20071123105532_20071127130013.txt';
	v_transfer_location varchar2(100) := 'gary.coles@ingg.com, timothy.cassidy@ingg.com';
begin	
	v_file_dir := 'DIR_BILLING_DATA';
	v_utl_filehandler := UTL_FILE.FOPEN(v_file_dir, v_file_name, 'r');
	UTL_FILE.fgetattr(v_file_dir, v_file_name, v_boolean, v_size, v_block);
	UTL_FILE.get_raw(v_utl_filehandler, v_rawfile, v_size);
	UTL_FILE.FCLOSE(v_utl_filehandler);

 	sys.utl_mail.send_attach_raw( sender 		=>	'Legion BDS - '||ora_database_name||' <legiondw@inspiredbroadcast.net>'
 								, recipients 	=>	v_transfer_location
 								, subject 		=>	'Legion BDS - Transfer Billing Group File'
 								, message 		=>	'Dear Client'||CHR(13)||CHR(13)||
 													'Please find attached this periods billing file.'||CHR(13)||CHR(13)||
 													'If you have any issues with this billing file please contact the Legion BI Team on bi-team@inspiredbroadcast.net'||CHR(13)||CHR(13)||
 													'Cheers'||CHR(13)||
 													'BI-TEAM'||CHR(13)||CHR(13)
 								, attachment	=>	v_rawfile
 								, att_inline	=>	FALSE
 								, att_filename	=>	v_file_name
 								);
end;



Cheers
Gary
Re: UTL_MAIL Attachments [message #283591 is a reply to message #283579] Tue, 27 November 2007 10:14 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Did you search on the site?

Regards
Michel
Re: UTL_MAIL Attachments [message #283596 is a reply to message #283544] Tue, 27 November 2007 10:22 Go to previous messageGo to next message
colesg
Messages: 11
Registered: October 2007
Location: London
Junior Member

I did and have found that utl_mail has a limit of 32k files. There is a method to do large files using utl_smtp but am going to use unix mail and uuencode within a unix script.

Cheers
Gary
Re: UTL_MAIL Attachments [message #283600 is a reply to message #283596] Tue, 27 November 2007 10:34 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Ok, Thanks for the feedback.

Regards
Michel
Previous Topic: Declare date and BEGIN problem
Next Topic: Dynamic SQL
Goto Forum:
  


Current Time: Fri Mar 29 01:38:06 CDT 2024