How to remove the character from new line at the beginning of the attachment?

Hi all

I tried to attach a .dat file that is generated to an external source and send it as an attachment by e-mail with UTL_SMTP, all things work, but the .dat file that is attached in email contains a new line that is Chr (10) on the start line and the content of the file is written to the second line from. This is a part of the code that deals with reading/writing of the attachment of mail to send.

Someone can help me on this point, is something to be changed in this code?



UTL_SMTP.write_data (c,
'Object ' | ': ' || P_SUBJECT | UTL_TCP. CRLF);
UTL_SMTP.write_data (c,
"MIME-Version: 1.0 ' |" UTL_TCP. CRLF. -Use the MIME e-mail standard
' Content-Type: multipart/mixed;' | UTL_TCP. CRLF.
""boundary ="- SECBOUND" ' | UTL_TCP. CRLF.
UTL_TCP. CRLF);
UTL_SMTP.write_data (c,
'- SECBOUND' | UTL_TCP. CRLF.
' Content-Type: text/plain; "|| UTL_TCP. CRLF.
' Content-Transfer_Encoding: 7 bit' | UTL_TCP. CRLF.
UTL_TCP. CRLF);
UTL_SMTP.write_data (c, UTL_TCP.crlf | l_text);
UTL_SMTP.write_data (c, UTL_TCP.crlf);
UTL_SMTP.write_data (c, UTL_TCP.crlf);
-----
UTL_SMTP.write_data (c,
'- SECBOUND' | UTL_TCP. CRLF.
' Content-Type: text/plain; "|| UTL_TCP. CRLF.
"name="/inetpub/wwwroot/Novation_Merge/FS_Extract.dat"' |"
UTL_TCP. CRLF.

' Content-Transfer_Encoding: 8 bit' | UTL_TCP. CRLF.
' Content-Disposition: attachment;' | UTL_TCP. CRLF. "filename =" ' | p_description |
TO_CHAR (SYSDATE, 'DD-MON-YYYY') | ".dat" ' | "
UTL_TCP. CRLF. UTL_TCP. CRLF. UTL_TCP. CRLF);


--------------------------------------------------------------------------------------

BEGIN

l_filehandle: = UTL_FILE.fopen ("c:\temp",
"FS_Extract.dat,"
« r »,
32767);
LOOP
UTL_FILE. GET_LINE (l_filehandle, l_buffer, 32767);

UTL_SMTP.write_data (c, l_buffer |) UTL_TCP. CRLF);

END LOOP;
EXCEPTION
WHILE OTHERS THEN
NULL;
END;

UTL_FILE.fclose (l_filehandle);



UTL_SMTP.write_data (c, '- SECBOUND-');
-----
UTL_SMTP.close_data (c);
UTL_SMTP. Quit (c);
EXCEPTION
WHEN UTL_SMTP.transient_error OR UTL_SMTP.permanent_error THEN
BEGIN
UTL_SMTP. Quit (c);
EXCEPTION
WHEN UTL_SMTP.transient_error OR UTL_SMTP.permanent_error THEN
NULL;
-When the SMTP server is down or unavailable, we do not have
-a connection to the server. Triggers the call to quit one
-except that we cannot ignore.
END;
RAISE_APPLICATION_ERROR (-20000,
"Failed to send messages because of the following error: ' |"
SQLERRM);
END;



Thank you

Amol-

I remember correctly, a single empty line serves as a separator between the header Mime and Mime body.

Copy the following code...

UTL_SMTP.write_data(c,
  '-------SECBOUND' || UTL_TCP.crlf ||
  'Content-Type: text/plain;' || UTL_TCP.crlf ||
  ' name="/inetpub/wwwroot/Novation_Merge/FS_Extract.dat"' ||
  UTL_TCP.crlf ||
  'Content-Transfer_Encoding: 8bit' || UTL_TCP.crlf ||
  'Content-Disposition: attachment;' ||UTL_TCP.crlf || ' filename="' || p_description ||
  TO_CHAR(SYSDATE, 'DD-MON-YYYY') || '.dat"' ||
  UTL_TCP.crlf || UTL_TCP.crlf ||UTL_TCP.crlf);  

.. generates 2 blank lines after the Mime header.

Delete the last CRLF and see if this fits the Bill.

Tags: Database

Similar Questions

  • How to remove a character from new line in a column

    Hi all...

    I have a column in a table in which some data contains a newline character to their last.
    I need to remove the line break characters.

    for example... are data
    "abcd
    '
    (Notice the end of the quote)... I need to get data under... "abcd".

    PLSS help me...
    Thanks in advance...

    Hello:

    select replace(column_name,CHR(13),'') from table_name;
    

    If it does not work, try Chr (10) instead of Chr (13).

    Saad,

  • How to remove the attachment of e-mail from Bob Hope singing of troops?

    I received an email from Bob Hope singing for the troops.  I removed it but now everytime I open an email and click on the room attached, all I can hear is Bob Hope singing mares eat oats and oat eating is!  I deleted my deleted mail, thinking that this would settle it, but it didn't.  How can I get rid of this nuisance?

    Hello

    ·          What mail client do you use?

    ·          What type of file you are trying to open?

    Step 1: Check if there are all programs that are running in the Task Manager. If so, then put an end to this program.

    http://Windows.Microsoft.com/en-us/Windows-Vista/what-is-Task-Manager

    Step 2: I suggest you to run an online virus scan.

    You can do a scan of PC security by clicking on the link http://onecare.live.com/site/en-us/default.htm and clicking on the analysis of a complete Service and accept the agreement.

    Diana

    Microsoft Answers Support Engineer

  • How to remove the newline from the query output?

    Hello

    How to remove the newline from the query output?
    have tried to replace select (column_name, Chr (10), ' ') from table_name.

    Published by: GreenHorn 11 Sep, 2008 12:53 AM

    Please consider, that windows uses a sequence of chr13 | Chr (10) Unix uses only a single character CHR (10).
    The new line characters may depend on the operating system.

    You might consider with:

    Replace (replace (column_name, Chr (13) |)) CHR (10), ' '), CHR (10),' ')

    Hartmut

    Published by: hartmutm on 11.09.2008 01:32

  • How to remove a city from the weather app in IOS 9.2.1?

    I have an IPhone6S that I bought recently and am running IOS 9.2.1. I can't understand how to remove a city from the weather app. I tried to go to settings, where there is a list of all the applications on my phone except the weather app, so no help there. Any body can help me with this?

    You must tap on the small set of lines in the lower right to get list view. Then you can find the city that you want to delete, drag to the left to see the button Delete.

    See you soon,.

    GB

  • Prime Minister 9. I made a mistake when I did drag an audio file in the line of the image. How to remove the audio file. I tried ctrl z and shift delete nothing done.

    Using Adobe Elements 9 first, I made a mistake when I did drag an audio file in the line of the image.

    How can I delete this audio file? I tried ctrl z and shift delete. software has the ' delete the scene and all of the properties in gray. Just "delete scene only" it and it does nothing to remove the audio file.  I had to drag the line from the soundtrack.

    Who can help me?

    LinFos04

    What you wrote, it seems that you are in the scene of Premiere Elements 9.0/9.0.1 workspace.

    Please see screenshot showing you how to remove the audio immediately after you dragged in the film that had been marked "Drag the next clip here"

    Moving forward consider working in the workspace of timeline that gives you a better view of what is happening and therefore gives you more control over the flow of work. Please click chronology to watch how this audio present in the workspace of chronology after what you did in the space of the stage line.

    Please let us know if it worked to get rid of the audio unwanted in the Premiere Elements 9.0/9.0.1 workspace sceneline.

    For any question or need more information on the above, please ask.

    Thank you.

    RTA

  • 2 How to remove an element from the tree and the database block tree?

    Hello

    2 How to remove an element from the tree and the database block tree?

    Kind regards

    Abdetu...

    The problem is caused by not sending forms is not a VALIDATION of the database because he thinks that there is no changes to save.

    Forms does know that changes to the data block, he does not know the changes made by the PLSQL INSERT, UPDATE, DELETE calls and procedure.

    Try to remove the line to block, rather than using a DELETION like that...

    go_block ('INSP_EQUIPMENT_TYPE');if form_success then   do_key ('DELETE_RECORD');end if;
    
    
    

    If you wish to continue using your original DELETE instead of my change above code, you can use different techniques to force forms to issue the COMMIT to the database, including this one...

            DELETE ...        FORMS_DDL ('COMMIT');
    

    Be careful... This will be the VALIDATION of the database, but the changes to the data block will not be sent to the database!

    I posted a few other ways to issue a VALIDATION of forms here
    www.seeristic.com/Forum_Posts/Forms_COMMIT.txt

  • How to remove a Word from the default dictionary of firefox?

    How to remove a Word from the default dictionary of firefox?
    If I wanted to remove the word 'dog' or 'and' for example

    There may be a range of reasons for wanting to do this, including the deletion of the words you use rarely as similar to other common spellings used words for example. "minute" and "Minuet", delete the words that you find personally offensive, or removing words that, because of linguistic or cultural background, you would not consider words at all.

    Note that I'm not asking how to remove my 'dictionary' words, words that I added myself.

    Hello

    I talked to a few people and I think I'm able to help you with this.

    There are two dictionary files, the default that comes with your version of Firefox and personal 'custom' that you create yourself with phrases and words.

    If you want to change the personal;

    1. Copy Subject: support and paste into the address bar.
    2. Next to the profile folder, click the marked File Show
    3. Find the file persdict.dat. Rename a text file, open, modify, re save it as persdict.dat and replace.

    If you want to change the default dictionary, it could be more of a problem and a lot more technique to do. I would recommend that you look at the problem differently and consider filtering of pages based on inappropriate content using Add-ons such as ProCon Latte Content Filter.

    I hope this helps, but if not, please come back here and we can look at another solution for you.

  • How to remove "Skype available" from the top of the notification page?

    How to remove "Skype available" from the top of the notification page - useless promotion!

    Hello!

    Disable the Skype status under Notification settings in Skype.

    All best
    Siim

  • I want to know how to remove the back cover of my HP Pavilion Sleekbook 15 to install the new memory?

    I want to know how to remove the back cover of my HP product name: HP Pavilion Sleekbook 15 to install the new memory?  All site shows HP Web is how remove caches memory.  Unfortunately, with the newer models like mine, the whole back cover needs to be removed.  I have tried in vain to remove it, but so far all that I managed to do is scratch my cover.  If anyone can help?

    Dear David

    It's a very good idea, it would also be a good excuse to use my new phone for this.  So I'll say thanks again for the good advice.  Have a great weekend you Mr.  As I said earlier, you're a star...

    Yours Sincerely

    Alan

  • Satellite A30 - 504 - how to remove the old HDD and new mount?

    Hello

    I have problem with my laptop satellite. After the turn on I've got Announces s.m.a.r.t. disk is damaged.

    I do not have it is why I do not know how to remove the old HDD and replace the new statement.
    I will be grateful for the help.

    Hello

    Looking first for similar discussions in this forum? I guess that you didn t ;)
    The advanced search option is very useful and you can search for single yarn that could help you.

    I found this:
    http://forums.computers.Toshiba-Europe.com/forums/thread.jspa?threadID=12526&MessageID=45688

    and this

    http://forums.computers.Toshiba-Europe.com/forums/thread.jspa?threadID=12547&MessageID=45752

    It seems that the hard drive on your A30 is in the optical drive, and you must remove all first the STRANGE before you get access to the HARD drive.

    Best regards

  • How to remove the effect - brightness, from there?

    How to remove the effect - brightness, from there.  First of all I thought to increase the sound volume using the BRIGHTNESS of the effect, but now improved Audio, I use the volume, which is enough.

    So I would remove the block of brightness from there.

    Thank you.

    The brightness setting should not have any effect as you turned it off.  .  .  the blue square is not lit.

    However, if you don't like the look of it sitting there, highlight as I did it and press the DELETE (backspace) key to make them disappear.

  • Win Update has 35 'language' listed on my update package. How can I get these updates ON my machine. I NEVER want to add to my computer. I want this great list of languages removed from the update list. How to remove the.

    Win Update has 35 'language' listed on my update package.  How can I get these updates ON my machine.  I NEVER want to add to my computer.  I want this great list of languages removed from the update list.   How to remove the.

    Hello

    If they are not installed then right click on them and HIDE

    If they are installed - Control Panel - Windows Updates - down left - installed updated - uninstall

    I hope this helps.

    Rob - bicycle - Mark Twain said it is good.

  • How to remove the watermark from desktop vista boot

    How to remove the watermark of ' Wndows Vista Starter from the desktop? I changed the same wallpaper theme and also reviewed the "Bcdedit" cmd.exe... "but in vain.

    Unfortunately it is one of the many limitations of vista boot,

  • How to remove the virus from 2012 security Win7

    How to remove the virus from 2012 security Win7?

    Hello jlybn1,

    Take a look at this link to see if it helps: http://www.bleepingcomputer.com/virus-removal/remove-win-7-security-2012

    This forum post is my own opinion and does not necessarily reflect the opinion or the opinion of Microsoft, its employees or other MVPS.

    John Barnett MVP: Windows XP Expert associated with: Windows Expert - consumer: www.winuser.co.uk | vistasupport.mvps.org | xphelpandsupport.mvps.org | www.silversurfer-Guide.com

Maybe you are looking for