Sending e-mail attachments with utl_mail.

Hello guys i would like to add an attachment to an e-mail using utl_mail
I have gotten this part done without a problem.
My problem now is that i have to loop a table and make the contents of the table an attachment to the e-mail.
So here is what i have so far.
DECLARE
   b64   VARCHAR2 (512) := 'WELL THIS IS A WHOLE LOT OF DATA!';         -- etc., as above
   txt   VARCHAR2 (512) := 'Dear Scott: ...';                -- etc., as above
BEGIN
   UTL_MAIL.send_attach_varchar2 (sender => 'xxxx'
                                , recipients => [email protected].'
                                , MESSAGE => txt
                                , subject => 'Attachment demo'
                                , att_mime_type => 'application/x-gzip'
                                , attachment => b64
                                , att_inline => TRUE
                                , att_filename => 'hugo.txt'
END;
/and i have a loop like this.
for rec in
   (SELECT
    FWTMP_REGPO_INV_NUM,
    FWTMP_REGPO_ERR_BAD_FUND,
    FWTMP_REGPO_ERR_BAD_ORGN,
    FWTMP_REGPO_ERR_BAD_PROG,
    FWTMP_REGPO_ERR_BAD_ACCT,
    FWTMP_REGPO_ERR_AMT_MORE,
    FWTMP_REGPO_ERR_NOPIDM_MATCH,
    FWTMP_REGPO_ERR_QTY_MORE,
    FWTMP_REGPO_ERR_ENC_LESS,
    FWTMP_REGPO_ERR_NOFP_MATCH,
    FWTMP_REGPO_ERR_NOFY_MATCH,
    FWTMP_REGPO_FTVFSYR_FSYR,
    FWTMP_REGPO_VEND_NUM,
    FWTMP_REGPO_ERR_INV_FOUND,
    FWTMP_REGPO_INV_AMT,
    FWTMP_REGPO_PO,
    fwtmp_regpo_credit_memo
FROM FWTMP_REGPO_INTRFACE
WHERE FWTMP_REGPO_ERR_IND = 'Y')
loop
           utl_file.put_line(f,rpad(NVL('Invoice Number: '||rec.fwtmp_regpo_inv_num,'0'||' '),200)||CHR(13)
           ||rpad(NVL('Fund Error: '||rec.FWTMP_REGPO_ERR_BAD_FUND,'0'||' '),200)||CHR(13)
           ||rpad(NVL('Org Error: '||rec.FWTMP_REGPO_ERR_BAD_ORGN,'0'||' '),200)||CHR(13)
           ||rpad(NVL('Program Error: '||rec.FWTMP_REGPO_ERR_BAD_PROG,'0'||' '),200)||CHR(13)
           ||rpad(NVL('Account Error '||rec.FWTMP_REGPO_ERR_BAD_ACCT,'0'||' '),200)||CHR(13)
           ||rpad(('Amount Error: '||rec.FWTMP_REGPO_ERR_AMT_MORE||'0'),200)||CHR(13)
           ||rpad(('Vendor Error: '||rec.FWTMP_REGPO_ERR_NOPIDM_MATCH||'0'),200)||CHR(13)
           ||rpad(('Quantity Error: '||rec.FWTMP_REGPO_ERR_QTY_MORE||'0'),200)||CHR(13)
           ||rpad(('Encumbrance Error: '||rec.FWTMP_REGPO_ERR_ENC_LESS||'0'),200)||CHR(13)
           ||rpad(NVL('period Error: '||rec.FWTMP_REGPO_ERR_NOFP_MATCH,'0'||' '),200)||CHR(13)
           ||rpad(NVL('Fiscal Year Error :'||rec.FWTMP_REGPO_ERR_NOFY_MATCH,'0'||' '),200)||CHR(13)
           ||rpad(NVL('Vendor: '||rec.FWTMP_REGPO_VEND_NUM,'0'||' '),200)||CHR(13)
           ||rpad(NVL('Invoice Error :'||rec.FWTMP_REGPO_ERR_INV_FOUND,'0'||' '),200)||CHR(13)
           ||rpad(NVL('Amount: '||rec.FWTMP_REGPO_INV_AMT,'0'||' '),200)||CHR(13)
           ||rpad(NVL('Po: '||rec.FWTMP_REGPO_PO,'0'||' '),200)||CHR(13)
           ||rpad(NVL('Credit memo: '||rec.fwtmp_regpo_credit_memo,'0'||' '),200)
           ||CHR(13)||'-------------------------------------------------------------------------------------------'||CHR(13));
    end loop;My challenge is simplly how to get the contents of the loop to the b64 variable. Any help would be greatly appreciated.
Thanks
Edited by: mlov83 on Sep 18, 2012 7:01 AM

mlov83 wrote:
I guess you have never been confused or frustuated. :-). That is why drinking copious amounts of coffee is important.
A simple example of code goes a long way.
SEND_ATTACH_VARCHAR2() call is explained in the documentation. Numerous source code examples can be easily found. Thus my criticism.
The basic concept is - the attachment parameter contains the contents (e.g. file content, text content, image contents) and the filename parameter names that contents.
Keep in mind that the document clearly states that the attachment data types are varchar2 and raw - both which are limited to 32KB. This means that larger attachment sizes will fail and that you need to use UTL_SMTP instead. Which is also documented in the same reference guide. And for which there are also a lot of examples.

Similar Messages

  • Can i send e-mail attachments with Nokia 9300?

    Pls help me. I'v been trying mad ways to send an e-mail attachment using Yahoo and Google but to no avail. Is such possible with my device? Pls help.

    Not by using the built in mail app only. The group feature doesn't exist in Apple's mail app. You need a third party app like this one.
    http://solubleapps.com/mailshot/
    or like this one.
    https://itunes.apple.com/us/app/group-email!-mail-client-attachments/id380690305 ?mt=8

  • When I send e-mail messages with file by using a POP3 in Exchange 2010 I received delivered message with file. How I can disable this functions that file do not include to delivery message. I use Exchange 2010 only local users.

    When I send e-mail messages with file by using a POP3 in Exchange 2010 I received delivered message with file. How I can disable this functions that file do not include to delivery message.  I use Exchange 2010 only local users.

    I think there is not native rule for this, but you could try a transport rule which removes all attachments over a very small file size like 1KB.
    http://blogs.technet.com/b/exchange/archive/2009/05/11/3407435.aspx
    CRM Advisor

  • To send a mail along with a csv attachment.

    Hi All,
    my requirement is to send a mail along with a csv file attached to it. Could someone provide me their valuable comments that will guide me. I am using the function module.
    SO_NEW_DOCUMENT_ATT_SEND_API1.

    https://forums.sdn.sap.com/click.jspa?searchID=22504268&messageID=6015600
    https://forums.sdn.sap.com/click.jspa?searchID=22504268&messageID=3640641
    https://forums.sdn.sap.com/click.jspa?searchID=22504268&messageID=6879100
    https://forums.sdn.sap.com/click.jspa?searchID=22504268&messageID=5281059

  • Is anyone else having a problem sending a mail message with PDF attached?

    Is anyone else having a problem sending a mail message with PDF attached? I receive the following message:
    Sending the message content to the server failed.
    Select a different outgoing mail server from the list below or click Try Later to leave the message in your Outbox until it can be sent.
    Is there a fix for this?

    Anyone?  I was hoping my problem would just 'fix itself'...  but I still have some clients telling me they're not receiving any email from me.  I've since deleted that account on my computers and re-added it.  But still having the same issue. 

  • Can Mail send interactive PDF attachments with URL links?

    I have tried without success to send a PDF that has URL links embedded (made in InDesign CS3). When this mail arrives the links are stripped out from the attached PDF. I do not want to send html mail for this purpose.
    Anyone have any answers? Thanks.

    Jon,
    The strong probability is that a SPAM filter in the path to the recipient has stripped them out -- Mail would not cause this. Have you tried opening the PDF with Acrobat Pro, doing a Save As, and then attaching that version to see if the same behavior continues.
    Ernie

  • Open e-mail attachments with Adobe Reader XI

    Why can't I e-mail open attachments with my Adobe Reader XI

    Save the attachment to the local disc and open it.

  • Sending internet mail error with cl_smtp_response

    We've a problem sending a external mail via smtp (lotus Notes v.6.5) with sapconnect on Sap version 4.7.
    With a telnet we can send external mails, but via sapconnect the system returns an error code
    554 554 relay rejected for policy reasons.
    Can anybody help us in order to solve this problem??
    Thanks

    Have you set your Notes server to accept the email addresses defined in your user in SAP (su01) ?
    Here are some great links for following up on email and SAP.
    How can i send an extranal mail from R/3

  • When I start using my yahoo mail account , I can't send / forward mail but with IE the problem just vanished

    I have been using Firefox since last couple of months and initially I was happy but recently with the issue I have highlighted , taken help of Yahoo but could not be resolved. When I have gone back to IE , the problem has been resolved .

    Sorry, I have no idea what you mean by '''"The Java plugin has created a time unfriendly issue with my e-mail account, I can not open or send any e-mail without using this plugin,"'''.
    If you think your problem is caused by the Java plugin, you should visit the Java support forum for assistance.
    http://forum.java.sun.com/index.jspa
    If you could explain what you mean by '''"time unfriendly''' issue with my e-mail account", maybe we'll be able to help you solve that issue.
    It might be helpful for us if we knew exactly which web-mail provider you are using. It seems strange to me that viewing or sending web-mail would actually "need" Java for operation, its more likely that some other item on the web page needs Java to run some advertising or other garbage that isn't a necessary part of the web-mail functionality you want to use.

  • Cant open Mail attachments with Yosemite OS

    Just installed Yosemite OS, and now I cant open Mail attachments when I double-click the attachments  - any file format!  What setting do I need to edit to enable viewing of attachment when I double-click on it?

    Why not post this in the forum that handles these things?
    The 10.8 Mail forum.
    DALE

  • Can't send e-mails+attachments

    I've read through past posts from people who are unable to send messages using Mail. I'm having a variation of this problem.
    I'm using a .Mac account and the smtp.mac.com server. I seem to be able send simple text-only messages, but anything with an attachment, even if it's a small .txt file, gets stuck in the outbox, and I eventually receive the "unable to send mail using the SMTP server"-type message that others have reported. I've tried using Entourage and Thunderbird as well, with similar results.
    Is there a reason my ISP would block only emails with attachments that come from an external SMTP? I'm brand new to OS X, so I'm probably overlooking something very obvious.
    Thanks in advance
    Chris
    iMac Intel Core Duo   Mac OS X (10.4.4)  

    Please reload the webpage while bypassing the cache using '''one''' of the following steps:
    *Hold down the ''Shift'' key and click the ''Reload'' button with the left mouse key.
    OR
    *Press ''Ctrl'' + ''F5'' or ''Ctrl'' + ''Shift'' + ''R'' (Windows and Linux)
    *Press ''Command'' + ''Shift'' + ''R'' (Mac)
    See if this helps solve the issues you had and please report back to us!
    '''Try the Firefox Safe Mode''' to see how it works there. The Safe Mode is a troubleshooting mode, which disables most add-ons.''
    ''(If you're not using it, switch to the Default theme.)''
    * You can open the Firefox 4.0+ Safe Mode by holding the '''Shift''' key when you use the Firefox desktop or Start menu shortcut.
    * Or use the Help menu item and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    ''Don't select anything right now, just use "'Start in Safe Mode"''
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shift key) to open it again.''
    '''''If it is good in the Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one.
    Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''

  • Cannot send/receive mails anymore with BB9300

    Hi, since the last 2 weeks, mails do not arrive to nor leave anymore from BB 9300.
    When I try to change my mail address, I cannot access the server
    Error message is "your terminal encounters a problem when trying to connect to the application server"
    What should I do to fix the problem ?
    Thank you

    Hi and Welcome to the Community!
    With a strong carrier network signal (e.g., not merely WiFi), I suggest the following steps, in order, even if they seem redundant to what you have already tried (steps 1 and 2 each should result in a message coming to your BB...please wait for that before proceeding to the next step):
    1) Register HRT
    KB00510 How to register a BlackBerry smartphone with the wireless network
    Please wait for one "registration" message to arrive to your Messages app
    2) Delete and Resend Service Books (pre-BB10 devices only)
    KB05000Delete the service book for the BlackBerry Internet Service email account from the BlackBerry smartphone
    If you have no CMIME entry, then skip the deletion
    KB02830 Send the service books for the BlackBerry Internet Service
    Please wait for "Activation" Messages, one per already configured email account, to arrive in your Messages. If you have no already configured email accounts, please wait 1 hour.
    3) Reboot
    Pre-BB10 Devices ONLY. With power ON, remove the back cover and pull out the battery. Wait about a minute then replace the battery and cover. Power up and wait patiently through the long reboot -- ~5 minutes.
    BB10 Devices. Hold the top button down until the counter reaches zero. Wait for the device to be fully shut down (e.g., nothing at all displayed on the screen, no LED lights, etc.). Hold the top button until the red LED is lit. Wait through the full boot-up process. IF this fails, you can attempt the battery-pull method above, but it is normally NOT recommended unless nothing else works.
    See if things have returned to good operation. Like all computing devices, BB's suffer from memory leaks and such...with a hard reboot being the best cure.
    Hopefully that will get things going again for you! If not, then you should contact your mobile service provider for formal support.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Extract mail attachments with Automator?

    I want to extract attachments from Apple Mail and save them in a Finder folder. There is an Automator action called "Get Attachments from Mail Messages" but when I set up a workflow
    -- Get Specified Mail Items
    -- Get Attachments from Mail Messages
    it doesn't work. (I get an error that says Messages: Permission denied (5353776)
    Can someone help me out here? Thanks.

    Yes, you can, with JavaMail it's actually very simple. Here's an example:
    http://www.esus.com/docs/GetQuestionPage.jsp?uid=1534

  • How to read the mails attachments with abap?

    HI All,
    I am looking for some way to read mails in the workplace inbox and to get their attachments.
    I will appreciate any help .
    Regards,
    Ari

    Does [this |http://help.sap.com/saphelp_nw04/helpdata/en/a7/3b2a2d45a34a23b75e3b18745c63bc/frameset.htm]help?
    Using the GET_ATTACHMENTS() attachment protocol method, get the attachment table. When reading the attachments, ensure that you use the GET_KIND() method to check the attachment object type before you access the data.

  • How do I send photos as attachments with iPhone 6?

    The photos are put in the body of the e-mail rather than as an attachment. The receiver cannot save the photo as a jpg.  How do I get around this problem?

    The receiver should be able to save photos whether they appear as separate attachments or seem to appear in the body.
    See here for some tips: http://www.computerhope.com/issues/ch000836.htm

Maybe you are looking for