Email from Plsql with attachment

Hello Masters,
I have a requirement where system needs to send the email with attachment. In my case I already have a file which needs to be send as attachment and stored in a directory (on database server).
Directory is created using below commands;
CREATE OR REPLACE DIRECTORY TEST_DIR AS 'c:\myfiles';
GRANT READ, WRITE ON DIRECTORY TEST_DIR TO USER_SCHEMA;
I just want to send mail with that file as attachment, basically there should be something where I should specify the path and it gets attached to the email.
Hope I have made clear. Kindly help me out for same.
Regards,

Thanks FrankKulash/Hoek,
I tried UTL_MAIL package, but couldn't get through. Below is what I tried;
DECLARE
  V_DIR    VARCHAR2 (30) := 'TEST_DIR';
  V_FILE  VARCHAR2 (30) := 'myfile1.xlsx';
BEGIN
  SYS.UTL_MAIL.SEND_ATTACH_RAW (
      SENDER          => '[email protected]',
      RECIPIENTS      => '[email protected]',
      MESSAGE        => '<HTML><BODY>See attachment</BODY></HTML>',
      SUBJECT        => 'Oracle Notes',
      MIME_TYPE      => 'text/html',
      ATTACHMENT      => V_DIR || '\' || V_FILE,
      ATT_INLINE      => FALSE,
      ATT_MIME_TYPE  => 'text/plain',
      ATT_FILENAME    => V_FILE);
END;
After executing above, I get error like;
ORA-06502: PL/SQL: numeric or value error: hex to raw conversion error
ORA-06512: at line 5

Similar Messages

  • Sending mail from plsql with attachement

    Hi Friends,
    i wanted to prepare an excel report and send that by email useing PLSQL .
    i know the inbuild packages UTL_FILE and UTL_SMTP can do this job . But my DBA not allowing me to do this . My DBA adviced me to do this work with in database by inplementing BLOB.
    I have never come accross to this task with in database , ( preparing the excel file and attaching that with mail and send it to users ) ??.
    can some one share tips & sample codes if any ???
    Thank You,
    Raj.

    First thing is Excel is Microsoft Specific and cant be created using UTL_FILE. May be as Excel supports CSV you can create CSV file using UTL_FILE.
    Next BLOB is a datatype like CHAR or VARCHAR2. You can store data in it. Thats all nothing much. With BLOB you can store an excel file. BLOB can't create or send it via EMail.
    So it would be better you talk to your DBA asking him to give more details.
    Thanks,
    Karthick.

  • Sending Email from PLSql Oracle 8.0.6

    Has anyone got any ideas or achieved this: Sending Email from PLSql for Oracle version 8.0.6 using the limited technology support in this version, i.e. UTL_SMTP & UTL_TCP are not supported.
    Any help will be greatly appreciated.

    Sending Email from PLSql for Oracle version 8.0.6 using the limited technology
    support in this version, i.e. UTL_SMTP & UTL_TCP are not supported.That's because they use Java and Java doesn't work with versions older than 8i. Does 8.0 support external procedures (I went straight from 7.3.4 to 8.1.6)? If so you might be able to cobble together some C to interface with smtp on the OS. Otherwise I think you're looking at writing some client-side application to do this.
    Cheers, APC

  • Send email from OWB with authenticated SMTP server (AUTH_LOGIN)

    Hi all,
    I want to send email from Oracle Warehouse Builder 11.2.0.2 using a SMTP server with basic authentication (AUTH_LOGIN).
    I've created an ACL for OWBSYS user according to note ID 1229769.1 in support.oracle.com.
    But, I need to configure again the ACL to connect to the SMTP server using user and password.
    I read the article in metalink, *How to Send an Email Using SMTP over an SSL Connection [ID 1323140.1]*+
    but I don't know how can I configure again the ACL for use in OWB.
    How OWB is able to authenticate with the SMTP server?
    Thanks!
    Maximiliano.

    Duplicate -
    How to send email from OSB with Mail server that requires SSL or STARTTLS
    Regards,
    Anuj

  • My new ipad 2 is missing Garage Band but I've  had a welcome email from Apple with a video showing how to use it. How do I get it?

    My new ipad2 is missing Garage Band but I've had a welcome email from Apple with a video of how to use it. How've do I get it?

    Thank you. I tried searching for it in the App store earlier but only the 'learn garage band in 30 days' came up - just tried again andvth garage band app came up. Great App for £2.99 !! Thanks for you help :-)

  • My photos shrink in size when emailed from IPHOTO or attached - How can I fix this. My friends say they can't see my pictures... thanks!!

    My photos shrink in size when emailed from IPHOTO or attached - How can I fix this. My friends say they can't see my pictures... thanks!!

    When you email from iPhoto, you have a choice as to the size of the picture - choose medium and your friends will be able to see them.  By the way, do your friends click on the photo attachment  in the mail to open it?

  • Sending email from Lr4 with Thunderbird

    Can anyone provide some help for  sending email from Lr4 with Thunderbird as the email program. When I select a photo and right-click Email Photo... I get the email photo dialog box with Mozilla Thunderbird in the From drop down. I click Send, and then I get an error message that says "There is no email program associated to perform the requested action. Please install an email program or, if one is already installed, create an association in the Default Programs control panel."
    Well, it seems as thigh Lr has Thunderbird in the From drop down, it knows an email program exists. Thunderbird is set as the default. I'm not sure what associations I am supposed to make (.eml and .wdseml are the default extensions, MAILTO is the default protocol, and Send mail is the default MAPI).
    Ay clues or hints?

    My default mail program is Thunderbird, and it works OK with Lightroom. If you are on a Windows 7 PC, go to Control Panel and check this out.
    Hope it helps.

  • Sending RTF Emails from PLSQL To Outlook

    Hi,
    I am currently attempting to send an email from a plsql program to a Microsoft Outlook program in rtf format as I need the email to be in a particular format. I am using utl_smtp to do this along with rich text format codes. Unfortunately Outlook does not recognise the fact that the resulting email file is in rtf format and displays the item as plain text (i.e. it displays the codes).
    Is there any way that Oracle can force Outlook to accept this format ? I've tried adding application/rtf as the mime type in the connection string but all this does is send the email as a word attachment when really what we need is for the email body to be in rtf format.
    Thanks in advance,
    Paul.

    Hi,
    I think you will find this is not an Oracle problem. Outlook uses the mime type to decide which application to open it with. The associations between types and applications are buried somewhere in the registry. And if it's not the mime type, it's the 3 letter extension that's used (but you didn't say what extension you were giving the attachment).
    If you just open a .rtf file on this computer, the one with Outlook on, by double clicking it, what application does Windoze use to open it? I bet you will find it's Word.
    HTH
    Chris

  • Problem in sending mail from database with attachment

    Hi All,
    I amd using forms10g,oracle10g
    I am facing a error while running a procedure to send mail from db
    procedure is:
    declare
    ErrorMessage VARCHAR2(4000);
    ErrorStatus NUMBER;
    -- enable SQL*PLUS output;
    --SET SERVEROUTPUT ON
    -- redirect java output into SQL*PLUS buffer;
    --exec dbms_java.set_output(5000);
    BEGIN
    ErrorStatus := SendMailJPkg.SendMail(
    SMTPServerName => '192.168.4.2',
    Sender => '[email protected]',
    Recipient => '[email protected]',
    CcRecipient => '',
    BccRecipient => '',
    Subject => 'hth106: Test JavaMail',
    Body => 'This is the body: Hello, this is a test that spans 2 lines',
    AuthReqdYNNum => 1,
    UserID => 'jagan',
    Password => 'songbirds',
    ErrorMessage => ErrorMessage,
    Attachments => SendMailJPkg.ATTACHMENTS_LIST('C:\oramail\MHTHSO_GEN45.html')
    END;
    while running this procedure i am receiving following error
    "ORA-29532: Java call terminated by uncaught Java exception:
    java.lang.IncompatibleClassChangeError"
    but the same procedure sending mail from all other user in the same database
    I am very myuch confused.i have given the all rights
    below mentioned rights are given .it is working in all other user on the same db except this user "hth106". And all the othere things are compared between working user and this hth106 user every things are same.But i am receiving error when i sending mail with attachment if the mail is sending without attachement it is working fine
    below rights are given to this user
    1.exec dbms_java.grant_permission('HTH106','java.util.PropertyPermission','*','read');
    2.exec dbms_java.grant_permission('HTH106','java.util.PropertyPermission','*','write');
    3.exec dbms_java.grant_permission('HTH106','java.net.SocketPermission','*','connect');
    4.exec dbms_java.grant_permission('HTH106','java.net.SocketPermission','*','resolve');
    5.exec dbms_java.grant_permission('HTH106','java.io.FilePermission','C:\oramail\*','read');
    exec dbms_java.grant_permission('HTH106','java.io.FilePermission','C:\oramail\*','write');
    6.call dbms_java.grant_permission('HTH106','java.net.SocketPermission','HTHDS01','resolve');
    7.call dbms_java.grant_permission('HTH106','java.util.PropertyPermission','*','read,write');
    7.call dbms_java.grant_permission('HTH106', 'java.io.FilePermission','C:\oramail\*','read');
    please advise me to proceed further
    Thanks in advance
    Thanks ,
    Antony

    With respects to the following:
    The bit you'll have most diffulty with is the attachment, because you can't be sure that
    the directory path specified is one that the database can read from. You can probably
    resolve this by using some java to move the file to a directory which utl_file can see.Another alternative is to specify a location on then database server where all file attachments MUST be copied to and the define and Oracle DIRECTORY (CREATE OR REPLACE DIRECTORY [dir_name] AS '/dir/name/on/files/system';) that references this location. When you attach a file to an email, then you only have to refer to the DIRECTORY for the file location.
    Just my 2 cents on the topic. :-)
    Craig...

  • HTML email from PLSQL package

    Hi,
    I have to create HTML table with PLSQL variable as row entry from PLSQL package and send this as email.
    Do we have any oracle package to send html email with Html code as Varchar from PLSQL package? Please provide me some example
    Thanks
    Senthil S

    Two packages ... HTP and HTF. Both documented and some demos here for HTP.
    http://www.morganslibrary.org/reference/pkgs/htp.html

  • Sending emails from preview with alternative email clients

    Hi, I've got a problem. I've changed my standard email-client from Apple Mail to Unibox. And, of course, I changed the standard email client in the adjustments of Apple Mail too. So everything is working fine except one thing:
    When I try to send a pdf-file from Apple preview.app as a mail, nothing happens. What can I do to tell Apple Preview to use my new Mail-client Unibox for sending mails?

    Hi, Kevin.
    I understand your need to support sales leave-behinds from your DPS app, which is why I wrote that blog post in the first place.
    The mailto: hyperlinking approach works well from a web browser, but the webkit overlay that we we get from iOS (that we use in DPS) is definitely not a browser. Browsers have special access to the local file system, where we would like to store PDFs to attach to email. The webkit overlay does not have this access, so we can't use the normal scheme of:
    mailto:[email protected]?subject=my%20email%20message&body=see%20attachment&attachment="\\myhost\myfolder\myfile.p df" to pass the path to Mail.app.
    This limitation means that you need to use some other method to provide access to that PDF. In my blog article (to which you refer), I provide a method to provide a form that would compose an email that contains a link to the PDF, which would need to be hosted somewhere the reader could access in their browser. An alternative to this approach would be to construct a server-side form that lets a validated user (sales rep?) select some files and send them to their customer. The email would need to be composed and sent from the server, and a quick Google search reveals whole pile of PHP examples of how to send email from a web form.
    Frankly, for your use case of sales enablement, I believe that a server-side system is the better choice, because it would provide you with a way to manage that content outside of DPS, so you can update it without having to republish your .folios.
    Thanks,
    James

  • Send email from iPhone with my iCloud alias

    Hi,
    My iCloud account is, let's say: [email protected]
    I created an alias, let's say: [email protected]
    I would like to use "[email protected]" on my iPhone and iPad but that seems impossible.
    1. i tried "add a new account" with "[email protected]": i'm said my password is not valid
    2. i tried to modify my current iCloud account: impossible, everything is greyed, the only way would be to delete the current, default iCloud account.
    So, what can be done in order to send an email on my iPhone from "[email protected]"?
    Thanks.

    No problem Scottie, you did your best indeed ;-)
    Yes I tried to login on icloud.com, no problem at all.
    What's more, before posting (starting the present thread), I'd called AppleCare: they certified there was no problem to set up an alias on my iPhone. Now I don't get time to talk with them again. Enough is enough.
    And just for the record: right after reentering my default "[email protected]" account details into my iPhone, i got an email from Apple saying "somebody" had done so on my iPhone and I'd better change my password!
    That means, at least to my opinion, that aliases are not taken into account at all by Apple on iDevices. The only thing that matters is our default "[email protected]".
    One more thing: why do I want an alias? Because as a former .mac and .mobileme customer I'm NOT ALLOWED BY APPLE to change my iCloud account name for a new one.
    This is a shame. My "[email protected]" name was meant for the entire family in the times of MobileMe. Now this "[email protected]" doesn't mean anything since iCloud accounts are INDIVIDUAL accounts.
    Apple are therefore harming their long-time, faithfull customers while somebody who was not a former MobileMe customer can change his/her iCloud account's name very easily. This doesn't make sense, I think.
    Hope that's clear.

  • Can't send email from Outlook with parentheses in address

    I can't send email from Outlook 2007 through my WRT400N when Outlook displays the address with parentheses as in this example: Firstname Lastname ([email protected])
    I can send if the address is in this form: Firstname Lastname <[email protected]>
    I have tested with the ISP and nothing gets through the router when the problem occurs. When I bypass the router, both forms of address will send correctly. This problem is perfectly reproducible. My router is brand new, but the problem did not show up for about a week after installation. OS is Win7. Any ideas? Thanks.
    -JimW
    Solved!
    Go to Solution.

    Try to forward the port 443 to 447 on the router.Check this link.

  • Sending external email from SAP with following requirements...

    Hi All,
           I need to send external emails from SAP by meeting following requirements.
    1) With subject line more than 100 characters.
    2) No attachments, only body which has specific format (blueprint/layout) and would be amended often, hence code shouldn't be touched during amendments.
    3) Should be able to know the success/failure of mail sending at program level.

    Hi,
    The code below demonstrates how to send an email to an external email address
    *& Report  ZSENDEMAIL                                                  *
    *& Example of sending external email via SAPCONNECT                    *
    REPORT  zsendemail                    .
    PARAMETERS: psubject(40) type c default  'Hello',
                p_email(40)   type c default '[email protected]' .
    data:   it_packing_list like sopcklsti1 occurs 0 with header line,
            it_contents like solisti1 occurs 0 with header line,
            it_receivers like somlreci1 occurs 0 with header line,
            it_attachment like solisti1 occurs 0 with header line,
            gd_cnt type i,
            gd_sent_all(1) type c,
            gd_doc_data like sodocchgi1,
            gd_error type sy-subrc.
    data:   it_message type standard table of SOLISTI1 initial size 0
                    with header line.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Perform populate_message_table.
    *Send email message, although is not sent from SAP until mail send
    *program has been executed(rsconn01)
    PERFORM send_email_message.
    *Instructs mail send program for SAPCONNECT to send email(rsconn01)
    perform initiate_mail_execute_program.
    *&      Form  POPULATE_MESSAGE_TABLE
          Adds text to email text table
    form populate_message_table.
      Append 'Email line 1' to it_message.
      Append 'Email line 2' to it_message.
      Append 'Email line 3' to it_message.
      Append 'Email line 4' to it_message.
    endform.                    " POPULATE_MESSAGE_TABLE
    *&      Form  SEND_EMAIL_MESSAGE
          Send email message
    form send_email_message.
    Fill the document data.
      gd_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      gd_doc_data-obj_langu = sy-langu.
      gd_doc_data-obj_name  = 'SAPRPT'.
      gd_doc_data-obj_descr = psubject.
      gd_doc_data-sensitivty = 'F'.
    Describe the body of the message
      clear it_packing_list.
      refresh it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      describe table it_message lines it_packing_list-body_num.
      it_packing_list-doc_type = 'RAW'.
      append it_packing_list.
    Add the recipients email address
      clear it_receivers.
      refresh it_receivers.
      it_receivers-receiver = p_email.
      it_receivers-rec_type = 'U'.
      it_receivers-com_type = 'INT'.
      it_receivers-notif_del = 'X'.
      it_receivers-notif_ndel = 'X'.
      append it_receivers.
    Call the FM to post the message to SAPMAIL
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           exporting
                document_data              = gd_doc_data
                put_in_outbox              = 'X'
           importing
                sent_to_all                = gd_sent_all
           tables
                packing_list               = it_packing_list
                contents_txt               = it_message
                receivers                  = it_receivers
           exceptions
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                others                     = 8.
    Store function module return code
      gd_error = sy-subrc.
    Get it_receivers return code
      loop at it_receivers.
      endloop.
    endform.                    " SEND_EMAIL_MESSAGE
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    form initiate_mail_execute_program.
      wait up to 2 seconds.
      if gd_error eq 0.
          submit rsconn01 with mode = 'INT'
                        with output = 'X'
                        and return.
      endif.
    endform.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    Hope this helps.
    Reward if helpful.
    Regards,
    Sipra

  • How to send email from OSB with Mail server that requires SSL or STARTTLS

    Hi everyone.
    My leader ask me configuration on OSB to support send email to my company mail server (using https chanel) and customer email (some of them is gmail that require STARTTLS or SSL).
    I've configured OSB as tutorial in that link: http://blogs.oracle.com/christomkins/entry/sending_an_email_from_oracle_s
    But OSB cannot send email from mail account that configured because it cannot login to mail server. I think the reason is secure authentication with SSL or TLS.
    There some problems that similar to mine in this forum but has nobody solved it yet.
    Can you tell me the solution you know? Any suggestion is appreciated.
    Regards
    Cuong Pham

    I know I'll offer you just a workaround and not a real solution, but you can try to start your own (intermediate) SMTP server to communicate with OSB (without SSL). Then you can just relay all the messages to your "real" SMTP server which requires SSL. If you start your intermediate SMTP server on the OSB host (localhost), then this layout could be acceptable even from security point of view.

Maybe you are looking for

  • Material master authorization

    Hi We gave a scenario where we need to have restrictions on access to material code. Eg while creating PR the user will be able to enter material starting with a specific item code. (the material code will be external no. generation) . Kindly advise

  • Probleme Mail server on OCS

    Hi, Im new at OCS, and i hope to know how lanching and configuring the ocs mail server. thx for your respons.

  • Form with 2 Iviews

    Hello I have a adobe interactive form which is filled by an employee and then the HR department should approve it How can I develop it so only the HR department user will see the approve / disapprove button ? should I create 2 iviews? thx Shai

  • Help needed to find motherboard manual

    Hi, I have a MSI motherboard: Micro-Star, model M56533, SIS 645, but I dont have the manual for it as it came in my Medion pc. I have bought a new case which has built in firewire, two usb, microphone and headphones and i want to plug them in, but ca

  • Why has'nt the 523:523 problem been fixed.

    Why  has,nt the 523:523 problem been fixed. I am now getting the problem when I try opening info from web sites