Naming attached file dynamically in PL/SQL UTL_SMTP email
Hi,
I am sending a .csv file attachment using UTL_SMTP mail in PL/SQL. The file name is hardcoded. But i want the file name to be dynamic at runtime. How can i make the file name dynamic.
Below is the sample code. The file name is excel.csv
'-------SECBOUND'|| crlf ||
'Content-Type: text/plain;'|| crlf ||
' name="excel.csv"'|| crlf ||
'Content-Transfer_Encoding: 8bit'|| crlf ||
'Content-Disposition: attachment;'|| crlf ||
' filename="excel.csv"'|| crlf ||
crlf ||
I want the file name based on the user who runs the programs. For Ex: If 'A' runs the program, the filename should be A.csv. How is this possible?
This is very urgent.
Thanks in Advance.
user11256082 wrote:
This is very urgent.Then you're in the wrong place. Your are looking for Oracle Support at https://support.oracle.com.
Do not expect a forum staffed by volunteers (most of whom are paid professionals and provide assistance in their spare time and for free) to jump to attention and give "urgent attention" to your problem simply because you are demanding that your problem be treated as more important and more critical than other people's problems posted here.
Similar Messages
-
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. -
Deploy a package in SSIS DB catalog and pass Config file dynamically in a SQL job
Hi,
I have a Package that needs to be deployed in SSIS Catalog DB.
Later I need to execute it through SQL Job.
Please let me know the steps how to do this and also I need to pass a Config file to run the package in SQL job.
Thanks,.
SailajaHi Sailaja,
Based on your description, you want to deploy a package to SSIS Catalog DB, then execute it through SQL Agent job with configuration file.
To deploy a package to SSIS Catalog DB, we can refer to the following suggestions:
SSMS-->Integration Service Catalogs-->SSISDB-->Your project-->projects. Right click on the projects, and choose "Import Packages...". Then make use of the Project Conversion Wizard to select the packages that you want to deploy, deploy
the generated .ispac file to SSIS Catalog. For more details, please see:
https://msdn.microsoft.com/en-us/library/jj852096.aspx
The command line tool DTUTIL.EXE which can be used to deploy SSIS packages. For more details, please see:
http://www.mssqltips.com/sqlservertutorial/215/command-line-deployment-tool-for-ssis-packages/
To schedule the package by using SQL Agent job, we should select Integration Services Package for the job step type, then add configuration file or add some properties form configuration file in the Configuration tab. For more details, please see:
https://msdn.microsoft.com/en-us/library/gg471507.aspx
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Is there a way to attach files linked in FormCentral form to email notifications?
As part of my FormCentral form design, the end User is required to link a file (copy of Purchase Order). Is there a way of forcing this file to attach to the email notifications? I can obviously see the file attachments in the backend and download from there, but it would be preferable if I could deliver with the email notification to circumvent other processes.
Any suggetsions?Sorry this is not possible to have the files attached to the email notification.
Gen -
How can I attach files or pictures when reply email?
How can I attach files or pictures when reply to email?
You can't in the present OS. If you'd like to see Apple add that capability, suggest such here:
http://www.apple.com/feedback/iphone.html -
Previously, when I got an email with an attached file, I can take out the file to different folders as I desire and then a filelink would take the place of the file in the email. In this way, when I opened email again, I can click the filelink and open the attached file in the folder to which I had moved.
Now, I find that there is no more such filelink after I take out the file. The attached file cannot be opened within the email now. Is the program changed or I miss anything?did you install an add-on that did that? or are you thinking of another mail program like Eudora?
-
SSIS to Export data from SQL to flat file dynamically
Hi.
I hope somebody can help me out, I have a table like this:
Date, StoreNumber, ProductCode, SalesItem, SalesAmout, Inventory
09-10-2014,10,1,10,10,30
As you can see I have a Date field and my table has information from 2014 at daily basis, What I'm trying to do is to export the information of this table to flat files, creating one file pear each date, as a result I will have about 280 files (one per date)
I do not know if it is possible or not.
Thank you.Hi Mike,
you can do it using one Execute SQL Task and a ForEach Loop variable driven.
1st the Execute SQL Task "figures out" how many iterations the loop would need. The SQL as follows would drive it:
SELECT DISTINCT [DATE] FROM MyTable;
and you get the dates placed into a package variable of type recordset for the [280] files.
And then you can operate on the recordset in the loop "shredding it" in a DFT with a source query dynamically driven by the date as "select a,b,c from mytable where date = '" + @[User::CurentDate] + "'" placing each
"date" into its own file even naming the file after the date using the current value of the package variable (ADO row concept).
See an example: http://www.sqlis.com/sqlis/post/Shredding-a-Recordset.aspx
Arthur My Blog -
File dynamically named & want to ignor some characters
Hi,
My ODI sources are files dynamically named with structure SR_10-04-2011-22-54.tx.gz --> SR_dd-mm-yyyy-hh24-mi.txt.gz , i'm trying to extract thoes files with ODIunzip so i created a package and passed a variable with that structure to the ODIunzip component, but as my files are generated by a platforme in a time, and the extraction begin later , the sysdate browth form Oracle by : select to_char(sysdate,'dd-mm-yyyy-hh24-mi') from dual ; to the variable is not conform with the file structure (minuts & seconds) so i'll bring just the dd-mm-yyyy form the sysdate, and what i need is to extract the file with that date , and ignor the seconds & minuts in the name of the file.
so Plz how can i do that?
or is there other way to extract this file?
thx a lot :)Jython tutorials..
http://www.jython.org/docs/tutorial/indexprogress.html
I would also look at the blogs on http://odiexperts.com/, and Oracles own tutorials around ODI -
How to UpLoad the Diffent type of files Through Oracle Pl/Sql...?
Hi TOM,
I want one reusable component to be developed, My requirement is as follows...
We get .CSV,.XML,.DOC.PDF files on the N/w drive. One Batch Job will be running every night and this job should upload all the files present in that N/w drive to the database (Each File should be stored in one row with unique ID) and after loading of each file is done , move the uploaded file to the backup directory.
Note : Average file size is 10-15 MB.
Loading of files in database should be done only using Oracle procedure/function.
Already return this process in Pro*C. But I don't know How to write in Oravle Pl/Sl...?
Functionality of this FUNCTION(In Pro*C):
===================================
*****set_item_blob
*****Input:
*****======
*****1. Path of the file in Windows folder which contains the part number's content
*****2. Item number in the T_ITEM table
*****3. Revision level in the T_ITEM table
*****Processing:
*****===========
*****1. Get the BLOB pointer for the ITM_BLOB column,
***** for the corresponding item number and revision level
*****2. Update the ITM_BLOB column with the content of the input file
***** ( using the EXEC SQL LOB WRITE function )
*****Output:
*****=======
*****1. ITM_BLOB column updated with the content of input file
int set_item_blob (char chr_item_number,int revision_level,char file_path)
exec sql begin declare section;
OCIBlobLocator *blob_locator;
varchar vc_item_number[12];
long file_length=0;
varchar alert_message [500+1];
int plsql_err_code = 0;
exec sql end declare section;
FILE *fp_input_file;
char *blob_buffer;
EXEC SQL VAR blob_buffer IS RAW(BUFFER_LENGTH);
EXEC SQL ALLOCATE :blob_locator;
memset ( vc_item_number.arr, '\0', 12 );
strcpy ( vc_item_number.arr, chr_item_number );
vc_item_number.len = strlen ( vc_item_number.arr );
fp_input_file = fopen( file_path, "rb" );
if( fp_input_file == NULL)
sprintf ( alert_message.arr, "ngetupld BLOB upload failed for item_number = [%s], rev_level = [%d]. Failure in opening the file to be uploaded [%s]", chr_item_number, revision_level , file_path );
alert_message.len = strlen ( alert_message.arr );
EXEC SQL EXECUTE
BEGIN
P_INSERT_INTO_INFO_MESSAGES('AL',:alert_message,'BLB',NULL,NULL,:plsql_err_code);
END;
END-EXEC;
exec sql commit;
return 1;
else
(void) fseek(fp_input_file, 0L, SEEK_END) ;
file_length = (unsigned int)ftell(fp_input_file) ;
(void) fseek(fp_input_file, 0L, SEEK_SET) ;
if ( file_length > BUFFER_LENGTH )
sprintf ( alert_message.arr, "ngetupld BLOB upload failed for item_number = [%s], rev_level = [%d]. Length of the file to be uploaded(%ld) is more than the supported length(%ld)", chr_item_number, revision_level , file_length, BUFFER_LENGTH );
alert_message.len = strlen ( alert_message.arr );
EXEC SQL EXECUTE
BEGIN
P_INSERT_INTO_INFO_MESSAGES('AL',:alert_message,'BLB',NULL,NULL,:plsql_err_code);
END;
END-EXEC;
exec sql commit;
return 1;
EXEC SQL
UPDATE T_ITEM
SET ITM_BLOB = EMPTY_BLOB()
WHERE ITM_NUMBER = :vc_item_number
AND ITM_REVISION_LEVEL = :revision_level
RETURNING ITM_BLOB INTO :blob_locator;
if ( sqlca.sqlcode != 0 )
sprintf ( alert_message.arr, "ngetupld BLOB upload failed for item_number = [%s], rev_level = [%d]. SQL error %d occured while trying to get the BLOB locator", chr_item_number, revision_level , sqlca.sqlcode );
alert_message.len = strlen ( alert_message.arr );
EXEC SQL EXECUTE
BEGIN
P_INSERT_INTO_INFO_MESSAGES('AL',:alert_message,'BLB',NULL,NULL,:plsql_err_code);
END;
END-EXEC;
exec sql commit;
return 1;
blob_buffer=(char *)malloc(BUFFER_LENGTH); // Dynamic Memory Allocation for Itm_Blob
fread((void *)blob_buffer, (size_t)BUFFER_LENGTH, (size_t)1, fp_input_file);
EXEC SQL LOB WRITE ONE :file_length FROM :blob_buffer INTO :blob_locator;
if ( sqlca.sqlcode != 0 )
sprintf ( alert_message.arr, "ngetupld BLOB upload failed for item_number = [%s], rev_level = [%d]. SQL error %d occured while trying to update the BLOB content", chr_item_number, revision_level , sqlca.sqlcode );
alert_message.len = strlen ( alert_message.arr );
EXEC SQL EXECUTE
BEGIN
P_INSERT_INTO_INFO_MESSAGES('AL',:alert_message,'BLB',NULL,NULL,:plsql_err_code);
END;
END-EXEC;
exec sql commit;
return 1;
exec sql commit;
fclose(fp_input_file);
free(blob_buffer);
return 0;
Can Possible to do in Oacle Pl/Sql...?> Hi TOM,
This is not asktom.oracle.com.
> Can Possible to do in Oacle Pl/Sql...?
Yes it can be done. Simply consult the applicable manuals that contains all of the details on how to do it. The manuals are:
- Oracle® Database Application Developer's Guide - Large Objects (refer to Chapter 6 section on Using PL/SQL (DBMS_LOB Package) to Work with LOBs)
- Oracle® Database PL/SQL Packages and Types Reference (refer to the chapter on DBMS_LOB) -
Unable to find line break between two lines in attachment file.
Dear all I will be very great full if someone help me out,
I am trying to send mail through SMTP server with an attachment of oracle report, but I am unable to find line break between two lines, when I down load the attachment from mail and open attach.txt file by double click on it. Next line starts right after previous line ends, it should starts with new line.
In order to send an attachment file, I am reading source file line by line and put MIME protocol’s attachment instance, contain of source file is being properly written into target file if I open that attachment on cmd prompt.
Following code may help you to understand the case.
Thanks in advance.
My code is as follows:-
create or replace procedure bec_file_test
v_subject varchar2, -- Subject of the email
v_body varchar2, -- Body of the email
v_from VARCHAR2 default 'XYZ.com', -- sender mail id
v_to varchar2 default 'XYZ.com', -- Field To of the email
v_cc varchar2 default 'XYZ.com' -- cc address
) is
-- variable to hold the smtp server connection
v_smtp_connection utl_smtp.connection;
-- variable to hold the smtp host name
v_smtp_host varchar2(100) default 'mail.bec-group.com';
-- variable to hold the smtp port
v_smtp_port number default 25;
-- composite of {CR}{LF} caridge return and line feed.
CRLF varchar2(2):=CHR(13)||CHR(10);
cursor pr_rec is
select requisition_no,line_no,release_no,a.contract,
a.project_id,substr(a.activity_seq,1,11)ACT_SEQ,
substr(a.part_no,1,12)PART_NO,
substr(a.description,1,32)DESCRIPTION,
substr(a.Bal_qty,1,8) BAL_QTY,
substr(a.unit_meas,1,5)UOM,
a.wanted_receipt_date WAN_REC_DT,
a.latest_order_date LAT_ORD_DT
from bec_pr_line_rep a
where a.Bal_qty>0 and a.header_state not in 'Closed'
and upper(a.state1) like 'RELEASED' and a.contract not in ('U1ENG','ULENG','U1FND','U2FND')
and a.buyer_code='70306'
order by a.part_no;
begin
declare
fHandle UTL_FILE.FILE_TYPE;
v_msg_line varchar2(2000);
-- v_buffer varchar2(20000);
--ALTER SYSTEM SET utl_file_dir = 'D:\Database\temp'
--COMMENT='Temporary change on Dec 14'
--SCOPE=SPFILE;
SELECT name, value
FROM gv$parameter
WHERE name = 'utl_file_dir';
--drop directory my_directory
--CREATE or replace DIRECTORY my_directory AS 'D:\database\temp';
--GRANT read,write ON DIRECTORY my_directory TO PUBLIC;
begin ---writing data into a file.
fHandle := UTL_FILE.FOPEN('MY_DIRECTORY', 'pending_pr_summry.txt', 'w');
UTL_FILE.put_line(fHandle, ' Pending PR to process (detail report)');
UTL_FILE.put_line(fHandle,TO_CHAR(SYSDATE,'MM-DD-YY HH:MI:SS AM'));
UTL_FILE.put_line(fHandle, '--------------------------------------------------------------------------------------------------------------------------------------------------');
UTL_FILE.put_line(fHandle, 'Req.no. li Re Site Prj Id Act seq Part no Description Qty UOM want rec dt lat ord dt' );
UTL_FILE.put_line(fHandle, '--------------------------------------------------------------------------------------------------------------------------------------------------');
for pr_temp in pr_rec loop
begin
v_msg_line:=to_char(rpad(pr_temp.requisition_no,12,' ')||'|'||
lpad(pr_temp.line_no,3,' ')||'|'||
lpad(pr_temp.release_no,3,' ')||'|'||
rpad(pr_temp.contract,7,' ')||'|'||
lpad(nvl(pr_temp.project_id,' '),7,' ')||'|'||
lpad(nvl(pr_temp.act_seq,' '),12,' ')||'|'||
lpad(pr_temp.part_no,12,' ')||'|'||
rpad(pr_temp.description,35,' ')||'|'||
lpad(pr_temp.bal_qty,10,' ')||'|'||
rpad(pr_temp.uom,6,' ')||'|'||
lpad(pr_temp.wan_rec_dt,14,' ')||'|'||
lpad(pr_temp.lat_ord_dt,14,' '));
UTL_FILE.put_line(fHandle,v_msg_line);
end;
end loop;
UTL_FILE.put_line(fHandle, '--------------------------------------------------------------------------------------------------------------------------------------------------');
UTL_FILE.put_line(fHandle, ' Regards : IFSAPP ( Application owner ) ');
UTL_FILE.FCLOSE(fHandle); ------------writing into file is successfuly done here!
--Reading of file starts here containt will be added in attchment file
fHandle :=UTL_FILE.FOPEN('MY_DIRECTORY','pending_pr_summry.txt','R' );
-- establish the connection to the smtp server
v_smtp_connection := utl_smtp.open_connection(v_smtp_host, v_smtp_port); /** OPEN CONNECTION ON THE SERVER **/
-- perform a handshake with the smtp server
utl_smtp.helo(v_smtp_connection, v_smtp_host); /** DO THE INITIAL HAND SHAKE **/
-- set the 'from' address of the message
utl_smtp.mail(v_smtp_connection, v_from);
-- add the recipient to the message
utl_smtp.rcpt(v_smtp_connection, v_to);
-- send the email
utl_smtp.open_data(v_smtp_connection);
v_msg_line:='Date: ' || TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || CRLF ||
'From: ' || v_from || CRLF ||
'Subject: ' || v_subject || CRLF ||
'To: ' || v_to || CRLF ||
'Cc: ' || v_cc || CRLF ||
'MIME-Version: 1.0'|| CRLF || -- Use MIME mail standard
'Content-Type: multipart/mixed;'||CRLF ||
' boundary="-----SECBOUND"'||CRLF||
CRLF ||'-------SECBOUND'|| CRLF ||
'Content-Type: text/plain;'|| CRLF ||
'Content-Transfer_Encoding: 7bit'|| CRLF ||
CRLF ||v_body|| CRLF; -- Message body
utl_smtp.write_data(v_smtp_connection,v_msg_line);
v_msg_line:='-------SECBOUND'|| CRLF ||
'Content-Type: application/octet-stream;'|| CRLF ||
'Content-Type: text/plain;'|| CRLF ||
'name="pending_pr_summry.txt"'|| CRLF ||
'Content-Transfer_Encoding: 8bit'|| CRLF ||
'Content-Disposition: attachment;'|| CRLF ||
' filename="pending_pr_summry.txt"'|| CRLF || CRLF; -- Content of attachment
utl_smtp.write_data(v_smtp_connection,v_msg_line);
-- check file is opened
IF utl_file.is_open(fHandle) THEN
-- loop lines in the file
LOOP
BEGIN -- Content of attachment
utl_file.get_line(fHandle,v_msg_line);
v_msg_line:=concat(v_msg_line,CRLF);
utl_smtp.write_data(v_smtp_connection,v_msg_line);
EXCEPTION
WHEN NO_DATA_FOUND THEN
EXIT;
END;
END LOOP;
END IF;
--end of attachment containt
utl_smtp.write_data(v_smtp_connection,v_msg_line);
UTL_FILE.FCLOSE(fHandle);
utl_smtp.close_data(v_smtp_connection);
utl_smtp.quit(v_smtp_connection);
exception
when utl_smtp.invalid_operation then
dbms_output.put_line(' Invalid Operation in Mail attempt using UTL_SMTP.');
when utl_smtp.transient_error then
dbms_output.put_line(' Temporary e-mail issue - try again');
when utl_smtp.permanent_error then
dbms_output.put_line(' Permanent Error Encountered.');
when others then
dbms_output.put_line('Exception: SQLCODE=' || SQLCODE || ' SQLERRM=' || SQLERRM);
RAISE;
end;
end bec_file_test;Pending PR to process (detail report)01-17-13 12:43:19 PM--------------------------------------------------------------------------------------------------------------------------------------------------Req.no. li Re Site Prj Id Act seq Part no Description Qty UOM want rec dt lat ord dt--------------------------------------------------------------------------------------------------------------------------------------------------MAT/250370 | 2| 1|ISCSP | 4977| 100004207| 0104000016|Angle 50 X 50 X 6 IS:2062 Grade |500|kg |30-NOV-2012| 20-nov-2012MAT/250370 | 3| 1|ISCSP | 4977| 100004207| 0105000002|Channel 100 X 50 IS:2062 Grade A | 1000|kg | 30-NOV-2012| 20-nov-2012MAT/250579 | 2| 1|NMDCJ | 6001| 100005580| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 2991|kg | 13-DEC-2012| 03-dec-2012MAT/250606 | 2| |NMDCJ | 6002| 100005860| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 4500|kg | 29-DEC-2012| 19-dec-2012MAT/250607 | |1|NMDCJ|6001|100005580| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 1500|kg | 29-DEC-2012| 19-dec-2012MAT/250194 | 3| 1|NMDCJ | 6002| 100005818| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 3939|kg | 29-DEC-2012| 19-dec-2012MAT/250606 | 4| 1|NMDCJ | 6002| 100005860| 0109020004|TMT Bar 16 mm Fe 415 IS:1786 | 39000|kg | 29-DEC-2012| 19-dec-2012MAT/250607 | 4| 1|NMDCJ | 6001| 100005580| 0109020004|TMT Bar 16 mm Fe 415 IS:1786 | 17500|kg | 29-DEC-2012| 19-dec-2012MAT/250194 | 2| 1|NMDCJ | 6002| 100005818| 0109020004|TMT Bar 16 mm Fe 415 IS:1786 | 12183|kg | 29-DEC-2012| 19-dec-2012MAT/250606 | 6| 1|NMDCJ | 6002| 100005860| 0109020006|TMT Bar 25 mm Fe 415 IS:1786 | 9500|kg | 29-DEC-2012| 19-dec-2012MAT/250607 | 6| 1|NMDCJ | 6001| 100005580| 0109020006|TMT Bar 25 mm Fe 415 IS:1786 | 4500|kg | 29-DEC-2012| 19-dec-2012MAT/250194 | 6| 1|NMDCJ | 6002| 100005818| 0109020006|TMT Bar 25 mm Fe 415 IS:1786 | 17500|kg | 29-DEC-2012| 19-dec-2012MAT/250607 | 7| 1|NMDCJ | 6001| 100005580| 0109020008|TMT Bar 32 mm Fe 415 IS:1786 | 22000|kg | 29-DEC-2012| 19-dec-2012MAT/250194 | 7| 1|NMDCJ | 6002| 100005818| 0109020008|TMT Bar 32 mm Fe 415 IS:1786 | 27060|kg | 29-DEC-2012| 19-dec-2012MAT/251138 | 1| 1|NMDCJ | 6002| 100005825| 3501000001|Cement 50 kg | 1|pkt | 25-DEC-2013| 14-dec-2013--------------------------------------------------------------------------------------------------------------------------------------------------
where as source file is like that:-
Pending PR to process (detail report)
01-17-13 12:43:19 PM
Req.no. li Re Site Prj Id Act seq Part no Description Qty UOM want rec dt lat ord dt
MAT/250370 | 2| 1|ISCSP | 4977| 100004207| 0104000016|Angle 50 X 50 X 6 IS:2062 Grade | 5500|kg | 30-NOV-2012| 20-nov-2012
MAT/250370 | 3| 1|ISCSP | 4977| 100004207| 0105000002|Channel 100 X 50 IS:2062 Grade A | 1000|kg | 30-NOV-2012| 20-nov-2012
MAT/250579 | 2| 1|NMDCJ | 6001| 100005580| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 2991|kg | 13-DEC-2012| 03-dec-2012
MAT/250606 | 2| 1|NMDCJ | 6002| 100005860| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 4500|kg | 29-DEC-2012| 19-dec-2012
MAT/250607 | 2| 1|NMDCJ | 6001| 100005580| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 1500|kg | 29-DEC-2012| 19-dec-2012
MAT/250194 | 3| 1|NMDCJ | 6002| 100005818| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 3939|kg | 29-DEC-2012| 19-dec-2012
MAT/250606 | 4| 1|NMDCJ | 6002| 100005860| 0109020004|TMT Bar 16 mm Fe 415 IS:1786 | 39000|kg | 29-DEC-2012| 19-dec-2012
MAT/250607 | 4| 1|NMDCJ | 6001| 100005580| 0109020004|TMT Bar 16 mm Fe 415 IS:1786 | 17500|kg | 29-DEC-2012| 19-dec-2012
MAT/250194 | 2| 1|NMDCJ | 6002| 100005818| 0109020004|TMT Bar 16 mm Fe 415 IS:1786 | 12183|kg | 29-DEC-2012| 19-dec-2012
MAT/250606 | 6| 1|NMDCJ | 6002| 100005860| 0109020006|TMT Bar 25 mm Fe 415 IS:1786 | 9500|kg | 29-DEC-2012| 19-dec-2012
MAT/250607 | 6| 1|NMDCJ | 6001| 100005580| 0109020006|TMT Bar 25 mm Fe 415 IS:1786 | 4500|kg | 29-DEC-2012| 19-dec-2012
MAT/250194 | 6| 1|NMDCJ | 6002| 100005818| 0109020006|TMT Bar 25 mm Fe 415 IS:1786 | 17500|kg | 29-DEC-2012| 19-dec-2012
MAT/250607 | 7| 1|NMDCJ | 6001| 100005580| 0109020008|TMT Bar 32 mm Fe 415 IS:1786 | 22000|kg | 29-DEC-2012| 19-dec-2012
MAT/250194 | 7| 1|NMDCJ | 6002| 100005818| 0109020008|TMT Bar 32 mm Fe 415 IS:1786 | 27060|kg | 29-DEC-2012| 19-dec-2012
MAT/251138 | 1| 1|NMDCJ | 6002| 100005825| 3501000001|Cement 50 kg | 1 |pkt | 25-DEC-2013| 14-dec-2013
Ignore alignment. It is well formatted in source file. -
Attach file to mail with "unusual" characters
Hi
I have made a procedure that can send mail with attached file/files. But when I attach a text file that contains characters like (Å, Ä or Ö) these characters gets like (A, A and ?) when I recieve the mail to my mail client. When I look at the file on the disk before I attach it the characters is OK but when I attach the file and mails it the characters get replaced. So why does the charaters get messed up when I attach the file to a mail??
My procedure looks like this:
procedure mail_files(from_name varchar2,
to_name varchar2,
subject varchar2,
message varchar2,
max_size number default 9999999999,
filename1 varchar2 default null,
filename2 varchar2 default null,
filename3 varchar2 default null,
debug number default 0) is
mottagare VARCHAR2(2048) := to_name;
v_smtp_server varchar2(32) := 'mail.telia.se';
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;
type varchar2_table is table of varchar2(200) index by binary_integer;
file_array varchar2_table;
i binary_integer;
v_file_handle utl_file.file_type;
v_slash_pos number;
mesg_len number;
mesg_too_long exception;
invalid_path exception;
mesg_length_exceeded boolean := false;
begin
-- first load the three filenames into an array for easier handling later ...
file_array(1) := filename1;
file_array(2) := filename2;
file_array(3) := filename3;
-- Open the SMTP connection ...
conn := utl_smtp.open_connection(v_smtp_server, v_smtp_server_port);
-- Initial handshaking ...
utl_smtp.helo(conn, v_smtp_server);
utl_smtp.mail(conn, from_name);
WHILE (mottagare IS NOT NULL) LOOP
utl_smtp.rcpt(conn, get_element(mottagare));
END LOOP;
--utl_smtp.rcpt( conn, to_name );
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_name || crlf || 'Mime-Version: 1.0' || crlf ||
'Content-Type: multipart/mixed; boundary="DMW.Boundary.605592468"' || 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 ||
'--DMW.Boundary.605592468' || crlf ||
'Content-Type: text/html; charset=8859-1' || crlf ||
'Content-Disposition: inline;' || crlf ||
'Content-Transfer-Encoding: 8bit' || crlf || '' || crlf ||
message || crlf;
mesg_len := length(mesg);
if mesg_len > max_size then
mesg_length_exceeded := true;
end if;
utl_smtp.write_data(conn, mesg);
--utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(mesg));
-- Append the files ...
for i in 1 .. 3 loop
-- Exit if message length already exceeded ...
exit when mesg_length_exceeded;
-- If the filename has been supplied ...
if file_array(i) is not null then
begin
-- locate the final '/' or '\' in the pathname ...
v_slash_pos := instr(file_array(i), '/', -1);
if v_slash_pos = 0 then
v_slash_pos := instr(file_array(i), '\', -1);
end if;
-- separate the filename from the directory name ...
v_directory_name := substr(file_array(i), 1, v_slash_pos - 1);
v_file_name := substr(file_array(i), v_slash_pos + 1);
-- open the file ...
v_file_handle := utl_file.fopen(v_directory_name, v_file_name, 'r');
-- generate the MIME boundary line ...
mesg := crlf || '--DMW.Boundary.605592468' || crlf ||
'Content-Type: application/octet-stream; name="' ||
v_file_name || '"' || crlf ||
'Content-Disposition: attachment; filename="' ||
v_file_name || '"' || crlf ||
'Content-Transfer-Encoding: 8bit' || crlf || crlf;
mesg_len := mesg_len + length(mesg);
utl_smtp.write_data(conn, mesg);
-- and append the file contents to the end of the message ...
loop
utl_file.get_line(v_file_handle, v_line);
if mesg_len + length(v_line) > max_size then
mesg := '*** truncated ***' || crlf;
utl_smtp.write_data(conn, mesg);
mesg_length_exceeded := true;
raise mesg_too_long;
end if;
mesg := v_line || crlf;
utl_smtp.write_data(conn, mesg);
mesg_len := mesg_len + length(mesg);
end loop;
exception
when utl_file.invalid_path then
-- All other exceptions are ignored ....
when others then
null;
end;
mesg := crlf;
utl_smtp.write_data(conn, mesg);
-- close the file ...
utl_file.fclose(v_file_handle);
end if;
end loop;
-- append the final boundary line ...
mesg := crlf || '--DMW.Boundary.605592468--' || crlf;
utl_smtp.write_data(conn, mesg);
-- and close the SMTP connection ...
utl_smtp.close_data(conn);
utl_smtp.quit(conn);
end;
Any help is highly appreciated.
Regards
NilsHi Madhu,
Using the default modules PayloadSwapBean and MessageTransformBean you can able to send multiple attachments.
swap.keyName :payload-name or payload-description or content-type, content-description. swap.keyValue: If you have a multiple attachments then give the multiple key value.
Like you have payload name
Attachment1, Attachment2 then
swap.keyName payload-name
swap.keyValue Attachment1, Attachment2
Using the MessageTransformBean you can able to change the file name.
PayloadSwapBean:
[http://help.sap.com/saphelp_nw70/helpdata/EN/2e/bf37423cf7ab04e10000000a1550b0/content.htm]
MessageTransformBean:
[http://help.sap.com/saphelp_nw70/helpdata/EN/57/0b2c4142aef623e10000000a155106/content.htm]
Regards,
Prakasu -
Can't Attach Files in 10.9 Mail via Menubar/Toolbar
All of a sudden I cannot attach files in Mail via menu commands. A selection (finder) window opens but all items are grayed out (no matter what location). I can still attach files by dragging them from the Desktop (or other location) into the body of the email.
Isolation:
-Issue persists in Safari when logging into webmail.
--Choosing to "attach" a file to an email (new composure or reply) from the webmail attach links brings up a Finder window with all content grayed out.
-Created test admin user.
--logged in as new user.
--set up Mail w/ an email account.
--attempted file attachment from menubar/toolbar icons.
--works.
***issue is user specific.
Resolution:
-Access primary user ~/Library/Preferences/.
--locate files named "com.apple.finder" .plist (may have multiple files w/ additional characters).
--select all and move to Trash.
--Restart.
-log in and test.E. Van Meter wrote:
Recently installed OX X 10.5 Leopard and ever since, I can't attach files to outgoing Gmail emails.
I've tried in Safari, Camino and Firefox -- no luck.
It does work if I switch to the "older version" of Gmail.
Does anybody know if there's a setting I can change so I can use Gmail normally but be able to add attachments to mail?
Anybody else having this issue?
Your profile indicates you are running a very old version of Leopard which might explain the issue.
Update to 10.5.8 using the combo update (not the auto software update) and see if that fixes your problem. -
Sending mail with attachment file through plsql
Hi,
Now i send the mail using utl_smtp and utl_tcp.
How can i send a mail with a attachment file. That file is in the local directory. Can any one know just send me to the following mail id [email protected]
Regards
SureshHi,
Now i send the mail using utl_smtp and utl_tcp.
How can i send a mail with a attachment file. That file is in the local directory. Can any one know just send me to the following mail id [email protected].
Regards
Suresh -
Mail adapter - how to dinamically change attachment file name in sending
How can I dynamically change the attachment filename when preparig email to be sent? The attachment is an invoice in XML format and I have to put the invoice number into the attachment file name.
Thanks in advance.
Giuseppe.Hi,
Go through this docs.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9e6c7911-0d01-0010-1aa3-8e1bb1551f05
http://help.sap.com/saphelp_nw04/helpdata/en/6b/4493404f673028e10000000a1550b0/content.htm
Hope these bloga are useful..
/people/community.user/blog/2006/09/07/email-reporting
/people/community.user/blog/2006/09/08/email-report-as-attachment-excelword
/people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step
/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
/people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1685 [original link is broken] [original link is broken] [original link is broken]
/people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter
Thanks,
Satya -
Post Migration from SP2010 -Attach File Button not working in any list new/edit forms
Hi,
We have migrated the SharePoint 2010 farm to Sharepoint 2013 on last saturday and we are noticing an interesting issue after the migration .
On any custom list on any web application ,When we create a new item,if we click on attach file button in the ribbon,nothing shows up on the screen.
In the browser Dev Tools its showing an error message as "Cannot read Property style of null".
This is happening on a javascript (form.debug.js) on line No : 5276
(document.getElementById("partAttachment")).style.display = "block";
There is no element rendered in html with id "partAttachment",which is causing this error to happen.
Solutions tried are
1) Modified the List Advanced Settings to disable and enable the attachments ,which did not work
2) Ran the Sharepoint Configuration wizard which did not fix
3)Tried reset the site definition for all pages in the site from site settings
4) Deactivated and activated all the activated features in the site collection
Its an OOB List New Form,no customizations has been done.
Similar error occurring with List Edit form as well
when you click on the List Item in the List default view when you navigate to the list and when you click on attach file,a popup dialog to upload attachments appearing,However its not working when you
navigate into the list item and tried to upload attachment.
Please help if any Solutions / thoughtsHi Christopher,
Thanks for your reply,
Farm Information
OS: Windows Server 2008 R2 SP1 Enterprise
SQL: SQL 2008 R2 SP2
SP -SharePoint 2013 with no CU applied
Method,we used is restored the content DB from SP2010 and attaching to SP2013 SQL Server
Site Collection is in 15 mode
It happens on new site collection even though its not migrated site.
Server is 16GB RAM 8Core Processor
If we create a new form from designer,attach file link is working
OOB New form.aspx is having List Form webpart
Custom New Form.aspx creaed with designer has data form webpart
if we create a new sharpoint site collection in 2010 mode,its working fine without any issues
Interestingly,all the javascript files loading were debug.js,Not sure how its loading all debug.js files
Maybe you are looking for
-
2nd Mac - best practices using iPhoto on both?
Hi - I just got a new MacBook and have an iMac that is still the "hub" of my photo library. It is, in fact, about a 180 GB iPhoto library. I know that I can't sync libraries between Macs (a shame - someone should come up with a way to that assuming t
-
SRM Offline Approval via Blackberries is not working
SRM Experts, We are using SRM 5.0, PI-7.0. We don't have SAP MI (mobile infrastructure) configured in the landscape. Whenever user approves the Shopping cart from blackberry, it does not work. If user approves from MS-Outlook, it works. I heard that
-
Had to re-install CS6, - cannot open RAW files in CS6 now?
-
Forms6i different Object Height at run time
Hi, I have a multiple detail block ( No. of record displayed 10 ) ,all i need to do is change the height of the item according to the length of the text stored in it. (set_item_instance_property) not working Edited by: 936956 on May 27, 2012 2:09 AM
-
we have a third party ear file deployed. I want to find out its contents such as the app descriptors web.xml, weblogic.xml , jar files and etc. How can I view these? TIA