attach a remote file to an e-mail in the oracle apex

I know that it is possible to send messages through apex oracle using apex email with an attachment with the following code.

DECLARE

l_id NUMBER;

BEGIN

l_id: = APEX_MAIL. SEND)

            p_to        => ' [email protected] ',

            p_from      => ' [email protected] ',

p_subj = > 'APEX_MAIL with attachment. "

p_body = > "Please see the attachment."

p_body_html = > ' review of < b > please < /b > the attachment ');

C1 (SELECT filename, blob_content, mime_type

OF APEX_APPLICATION_FILES

WHERE ID IN (123 456)) LOOP

APEX_MAIL. ADD_ATTACHMENT)

p_mail_id = > l_id,

p_attachment = > c1.blob_content,

p_filename = > c1.filename,

p_mime_type = > c1.mime_type);

END LOOP;

COMMIT;

END;

/

but, I want to attach a remote file to a mail sent by apex oracle instead of the content of the blob object

p_attachment = > c1.blob_content,

for example, I want to attach a file, for example "D:\sample.pdf" as an attachment in the mail.

I want to know if it is possible and if possible how?

Hello

If your file is located on a remote FTP server and that you have permissions to access and read the file, you can use a PL/SQL's FTP API to retrieve your file from the remote FTP server:

https://Oracle-base.com/articles/Misc/FTP-from-PLSQL#PLSQL-FTP-API

-Retrieve a binary file on a remote FTP server.

DECLARE

  l_conn UTL_TCP.connection;

BEGIN

  l_conn := ftp.login('ftp.company.com', '21', 'ftpuser', 'ftppassword');

  ftp.binary(p_conn => l_conn);

  ftp.get(p_conn => l_conn,

  p_from_file => '/u01/app/oracle/product/9.2.0.1.0/sysman/reporting/gif/jobs.gif',

  p_to_dir => 'MY_DOCS',

  p_to_file => 'jobs_get.gif');

  ftp.logout(l_conn);

END;

/

Then you can import the file into a BLOB data type:

https://Oracle-base.com/articles/8i/import-BLOB

DECLARE

  l_bfile BFILE;

  l_blob BLOB;

BEGIN

  DBMS_LOB.createtemporary(l_blob, TRUE); -- Initialize the BLOB.

  l_bfile := BFILENAME('MY_DOCS', 'jobs_get.gif');

  DBMS_LOB.fileopen(l_bfile, DBMS_LOB.file_readonly);

  DBMS_LOB.loadfromfile(l_blob, l_bfile, DBMS_LOB.getlength(l_bfile));

  DBMS_LOB.fileclose(l_bfile);

  DBMS_LOB.freetemporary(l_blob); -- Relase the resources associated with the temporary LOB.

END;

/

Now you have the BLOB that you can pass as a parameter to the api APEX_MAIL.

Kind regards

smoliveira

Tags: Database

Similar Questions

  • When you try to attach a PDF file to an e-mail message in Yahoo Mail I'm unable to send the e-mail message.

    I get this message when I try to attach a PDF file to a Yahoo Email and it prevents me to send the attachment.

    original title: access denied, line 56, Char7

    Hi Harvey.s,

    1. Did you the latest changes on the computer?
    2. What web browser you use to access yahoo mail?
    3. Having similar problem when setting all other files as a word document in the email?
    4. You have security software installed on the computer?

    Check if you are facing the similar question in the setting of all other files in yahoo mail.

    Try the procedure only if you use the browser Internet explorer to access yahoo mail below.

    How to resolve script errors in Internet Explorer on Windows computers

    http://support.Microsoft.com/kb/308260

  • HTML template for e-mails in the oracle soa suite

    Hi all

    I am trying to create a standard email template that can be used to send emails from Oracle soa as a result of the help of ums adapter activity or by e-mail.

    As if I get IN. info, I should fill in the data of PO in the email with headers, the headers and footers. For even if I get the XML invoice I should use same template to generate the e-mail of the sample.

    Is it possible in soa or is this the right way to go?

    Thank you.

    Don't know what you are after here...

    I think all you need is an XSL transformation that will generate the HTML instead of XML...

    See you soon,.

    Vlad

  • When I try to attach a pdf file to an e-mail it is printed in El Capitan why

    Why, a PDF file is saved under the ribs (top Capitalan) not come up as an attachment but rather returning to full printed form?

    In the mail?

    Try control - clicking it and see if you get an option to do an attachment.

    Terminal command to try.

    defaults write com.apple.mail DisableInlineAttachmentViewing - bool YES

  • When I attach a pdf file to an e-mail message, it displays the file in full no not as an attcahment

    Why is it when I attach PDFs to an e-mail message, they show the full document of the file not as a pdf file icon... I have attached a passport to send and it showed the page of the passport and not on the pdf icon... I don't understand why? Someone at - it help him?

    Paul

    Right-click on the attachment PDF full size and in the context menu, select display as icon.

  • How can I attach a picture file to an e-mail. Whenever I click, the action opens just the file instead of attaching it to the email.

    I try to attach a file of pictures to send to friends by e-mail.  Can someone help me please?

    First of all, make sure that the entire file does not exceed the limit set by your mail server. Check first with them over the limit.

    Suugestion only:
    Could a right click on the file > Send to > compressed (zipped) folder.
    Now, attach the file zipped e-mail.
    P.S. I think that you should always check with the size of the zipped folder.

  • Attach a PDF file when sending e-mail

    Hello

    Can you help me to send a pdf file as an attachment when sending mail.

    Also, please tell me the required configuration changes that need to be done.

    It is important that where is your file that you are trying to reach and how you create the file object out of it to go to the MimeMessageUtils.setContent (). Thus there is no specific location to place the file you just create its object file correctly. For example if your PDF is created by another application and it is present in the so-called C:\app\output\pdf or/usr/local/app/output/pdf so that you can do is to define a Java System property (let's name the property system as file.attach.dir) through your scripts to start the server with comme-Dfile.attach.dir=C:\\app\\output\\pdf ou-Dfile.attach.dir=/usr/local/app/output/pdf

    And then, in your code you can do something like:

    Attachment of files = new queue (File.separatorChar + System.getProperty ("file.attach.dir") + "attachment.pdf");
    MimeMessageUtils.setContent (message, content, seizure, false);

    You can also place files for attachment to a specific folder of ATG and access it using atg.nucleus.DynamoEnv. Say that the file is in a directory called 'attachments' in the ATG data directory which by default is \home in the case of an attained EAR you can do

    Attachment of files is new leader (atg.nucleus.DynamoEnv.getDataDir () .getPath () File.separatorChar + "attachments" + File.separatorChar + "attachment.pdf");.
    MimeMessageUtils.setContent (message, content, seizure, false);

    If you make and deploy EAR on the application server as stand-alone then you might already have the ATG data directory affect some location through the property system - Datg.dynamo.data - dir in your server startup scripts. So, if this is the case, you can use this same property as described earlier in the first approach.

    You can always check the path of the file and know if he is getting properly solved using Java API file as file.getPath () and file.exists () where the file is the file object that you created. Make sure file.exists () return you true and that you will not encounter a FileNotFound Exception.

  • No idea how to configure the e-mail feature in oracle apex

    Hi guys please could someone help me understand how the E-mail present works in the apex I know it works at the level of page processing, but it could also work to the level of the table

    For example

    : When a user connects to a survey application, and they are supposed to do four quotas and they do only two how would I created the e-mail feature to remind them to complete the other two remaining assessments

    Send email to a trigger from the table. The trigger could count the number of assessments and if the 2 have been completed, an e-mail can be sent.

    If you don't want to use a trigger just use dbms_scheduler to run a task once a day, week, etc., to find people who have completed only 2 ratings and send them an email.

  • Send an e-mail using the Oracle database

    Hello!
    I installed Oracle 10 g (10.2.0.4) and I need to send an email using this database. In some notes said to run the following script, but in my case Oracle I don't have the owner "MailSender" or the AptMail function.

    Start
    dbms_output.put_line (mailsender. AptMail ('p_from', 'p_to', null, null, 'p_subject', null, 'p_smtp_host', null, null, null));
    END;

    Can someone explain if it is the right method to send an email using the Oracle database? If so how can I install it?

    Thank you
    Augusto

    Oracle 10.2 comes with UTL_MAIL package.

    Give it a read through the documentation. It's pretty simple to use.

  • Problems attaching a PDF of email (hotmail) in Mail on a Mac

    Hello

    I'm trying to attach a PDF file to an e-mail - using Hotmail on Mac Mail. It made plenty of times before and can fix other things (by doc Word excel spreadsheet etc.).

    Following message appears.

    Please wait...

    If this message is not subsequently to display the content of your document, your PDF reader isn't able to display this kind of document.

    Goes on to say retrieves the most recent version of Adobe etc - I already had.

    Any suggestions please?

    I'm confused. He will join an e-mail message you send?

    Looks like since you mention view that yo try to view an attachment.

    What is the source / what created the pdf file?

  • WINDOWS STOPS WORKING WHEN I REATTACH A FILE TO AN E-MAIL IN OUTLOOK MAIL, WHY?

    WHEN I TRY TO ATTECH A FILE TO AN E-MAIL IN THE NEW MESSAGE OF WINDOWS 'OUTLOOK MAIL' SAYS THAT WINDOWS HAS STOPPED WORKING, ETC, STOPS AND OPENS AGAIN, ANYONE KNOW WHY?

    Hello

    Thanks for posting your question on the Microsoft community.

    I would like to know some information about the problem so that we can help you better.

    What is the full error message when you say: "WINDOWS has CEASES to OPERATE?

    Thank you for details on the issue.

    This problem may occur because of the corrupted e-mail settings. If you access your email using webmail, then corrupt Add-ons and settings can also cause this problem.

    Please refer to suggestions provided by Jen_C. on May 10, 2013 in this thread and check out them.
    I'm not able to work with attachments in Outlook.com
    http://answers.Microsoft.com/en-us/outlook_com/Forum/oemail-osend/thread-4-IM-not-able-to-work-with-attachments-in/677f94a3-2d54-4d97-8568-fef588e752d8

    Note: The feature reset the Internet Explorer settings can reset security settings or privacy settings that you have added to the list of Trusted Sites. Reset the Internet Explorer settings can also reset parental control settings. We recommend that you note these sites before you use the reset Internet Explorer settings. Reset Internet Explorer is not reversible, and all the previous settings are lost after reset.

    I hope this information helps.

    Please let us know if you need more help.

    Thank you

  • Remote files does not

    I use Dreamweaver (8.0.2) which I used for several years without incident. Now, I'm unable to see my remote files. When I click on the icon that connects to the remote host (or when I right click 'put' the file to load on the remote server), the background file activity bar appears with the message "Recovering from remote folder to < site >" it takes longer than usual, about 20 seconds more. When he finishes, "Full file activity," the directory (folder) the contents of the site are displayed in the window of the remote site, but when I click on it to view the files in the site, nothing happens.

    Now I can't update or view my files on the remote server using DW.

    I run about 8 files through DW and the same thing happens with all of them. I have not changed the FTP settings for any of them.

    Do you know what is happening and how can I solve this problem?

    Amy

    Yes, it's the good folder level. But you made me think that lead to what seems to be a solution. I activated the passive FTP option in the settings. Now, I could see my files in directory. I can't imagine what has changed to force me to do it now, but it seems that my problem is solved.

    But thanks, anyway!
    Amy

  • I have windows professional xp and when I try to attach a file to an e-mail or even see where I saved them they do not appear.

    Original title: WINZIP HELP

    I have windows professional xp and when I try to attach a file to an e-mail or even see where I saved them they do not appear.  I'm looking for all THE files, but no zipped files are there.  Help, please!

    Hello

    1. What mail client do you use?

    I suggest you to check if the files are hidden:

    http://www.Microsoft.com/resources/documentation/Windows/XP/all/proddocs/en-us/WIN_FCAB_SHOW_FILE_EXTENSIONS.mspx?mfr=true

    Also check out this link:

    http://support.Microsoft.com/kb/306531

    It will be useful.

  • Can I attach a file to an e-mail message? It seems that I can reach only an individual file.

    I would like to a folder that contains many subfolders in it by email, but I can't attach it to the email. Is it possible to accomplsh another attatching the respective times of two of each folder?

    Thank you

    Bob Ford

    Using Windows Mail? The file zip and then it will go. (As long as the size is acceptable). Bruce Hagen
    MS - MVP October 1, 2004 ~ September 30, 2010
    Imperial Beach, CA

  • need help, can not attach the image file to my yahoo mail.

    need help, trying to compose e-mail... can not attach the image file to my yahoo mail... using firefox. Vista starter edition

    using 3 G hsdpa usb modem, model huawei E156G

    download stats is 0.00 KB its not not download, http://img337.imageshack.us/img337/2547/3ginterface.jpg

    the strange thing is that if I only download small file/pic as 50 KB download data passes through, but as 1 MB image file or more it will not pass and remained at 0.00 kb

    I tried to run administrator (always on the standard user account)---> cmd---> ipconfig/flushdns, still the same problem.

    Hi korgmeister,

    1 when was the last time it was working fine?

    2. do you have security software installed on the computer?

    3. are you able to access all Web sites?

    First of all, I suggest that you try to download the file with Windows internet explore.

    If you are able to download using Windows internet explore, then there may be a problem with the Firefox browser.

    Uninstall and reinstall Firefox browser and check.

    If you are facing a similar issue when you use Internet explore, then it may be Internet problem try to download some other file or document check if it works.

    Also contact your internet service provider to check if the connection side there is fine.

    Go back with the results!

    I hope this helps!

    Halima S - Microsoft technical support.

    Visit ourMicrosoft answers feedback Forum and let us know what you think.

Maybe you are looking for