How to make a picture as the content of the body of my mail using Oracle 10 g

Hi all

I already did the fixing of the image using SMTP concept. Now, I want to show my picture as my mail body content.

is it possible to do it in oracle 10g?


Can anyone help me do this?


See you soon,.
San

San wrote:
But I want to send the image in the main line, the file that is stored in the server database (Oracle Directory).

OK, so the situation is that you have an image in a BLOB, and you want to send this inline.
Then you can do a combination of both procedures and the MIME technique described by Billy Verreynne in his post above (thanks, Billy: D)

Sort of, something like this (restored your examples and Billys:)

  UTL_SMTP.open_data(l_mail_conn);

  UTL_SMTP.write_data(l_mail_conn, 'Date: ' || TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS') || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'To: ' || p_to || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'From: ' || p_from || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'Subject: ' || p_subject || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'Reply-To: ' || p_from || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'MIME-Version: 1.0' || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'Content-Type: multipart/alternative; boundary="' || l_boundary || '"' || UTL_TCP.crlf || UTL_TCP.crlf);

  IF p_text_msg IS NOT NULL THEN
    UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || UTL_TCP.crlf);
    UTL_SMTP.write_data(l_mail_conn, 'Content-Type: text/plain' || UTL_TCP.crlf || UTL_TCP.crlf);

    UTL_SMTP.write_data(l_mail_conn, p_text_msg);
    UTL_SMTP.write_data(l_mail_conn, UTL_TCP.crlf || UTL_TCP.crlf);
  END IF;

  IF p_html_msg IS NOT NULL THEN
    UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || UTL_TCP.crlf);
    UTL_SMTP.write_data(l_mail_conn, 'Content-Type: text/html' || UTL_TCP.crlf || UTL_TCP.crlf);

    UTL_SMTP.write_data(l_mail_conn, p_html_msg);
    UTL_SMTP.write_data(l_mail_conn, UTL_TCP.crlf || UTL_TCP.crlf);
  END IF;

  IF p_image_blob IS NOT NULL THEN
    UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || UTL_TCP.crlf);

    /* These values taken from Billys example - replace by your own image name and type >>> */
    UTL_SMTP.write_data(l_mail_conn, 'Content-Type: image/png; name="image1.png"' || UTL_TCP.crlf);
    UTL_SMTP.write_data(l_mail_conn, 'Content-Transfer-Encoding: base64' || UTL_TCP.crlf);
    /* Use something unique here - the value of Content-ID is to be used in your HTML IMG tag */
    UTL_SMTP.write_data(l_mail_conn, 'Content-ID: ' || UTL_TCP.crlf);
    UTL_SMTP.write_data(l_mail_conn, 'Content-Description: image1.png' || UTL_TCP.crlf);
    UTL_SMTP.write_data(l_mail_conn, 'Content-Location: image1.png' || UTL_TCP.crlf || UTL_TCP.crlf);

    /* <<< */

    /* >>> This is your own example of writing the image blob into the mail as base64 encoded >>> */

    /* Writing the BLOL in chunks */
    WHILE l_pos < l_blob_len LOOP
      DBMS_LOB.READ(l_blob, l_amount, l_pos, l_buffer);
      UTL_SMTP.write_raw_data(l_mail_conn,
                              UTL_ENCODE.BASE64_ENCODE(l_buffer));
      UTL_SMTP.WRITE_DATA(l_mail_conn, UTL_TCP.CRLF);
      l_buffer := NULL;
      l_pos    := l_pos + l_amount;
    END LOOP;

    /* <<< */

    UTL_SMTP.write_data(l_mail_conn, UTL_TCP.crlf || UTL_TCP.crlf);
  END IF;

  UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || '--' || UTL_TCP.crlf);
  UTL_SMTP.close_data(l_mail_conn);

  UTL_SMTP.QUIT(L_MAIL_CONN);

And then your body HTML should be something like this:

  l_html := '
    
      Test HTML message
    
    
     

This is a HTML version of the test message.

';

The trick is that img src can point to an image in line with the cid: syntax, where you use the value of the Content-ID header.
If you have multiple images, you just repeat add blobs as above with each their own unique Content-ID you can then use as img src tags in your HTML code.

All this is not tested and I leave you to encapsulate in a procedure and to BLOB handling etc.
But you get the idea, I am sure - just mix your solutions with Billys ;-)

Tags: Database

Similar Questions

  • Simple question... How do to add pictures on the body of my MAILS found 1000 results for how can I add photos to my Thunderbird emails

    How can simple question - I add photos to my mail body. But instead of the answer - found 1000 results for how can I add photos to my Thunderbird emails. There are answers that don't apply at all to the question anyway. Why must it be so difficult to get a simple answer to a simple question?

    Thunderbird is a bit like Microsoft, all the reasons as I dumped MS Live Mail.

    First, a lot of help for Thunderbird refers to the menus that may not be visible. It would be useful to you and us if you have your menus and toolbars visible.

    http://chrisramsden.vfast.co.UK/13_Menus_in_Thunderbird.html

    Then, open a window of writing. Activate the menu and operate.

    Now that you see an option "Insert"?

    If this isn't the case, you can assign composing in plain text, which does not support embedded images.

    Tools | Account settings| {Select account} | Composition & addressing and ensure "Compose messages in HTML format" are checked. If it is not already checked, go back to writing a message. No better now?

    Once you have the mode of composition HTML goes, you can use Insert | Image or various permutations of copy - paste and drag - move to the body of your message.

    A manual of sorts: http://en.flossmanuals.net/thunderbird/composing-messages/

  • How to make a picture of MS and a recovery CD to my HD using Win Pro 7?

    I completely under license from MS Windows 7 Pro and Office Pro 2007.

    I recently went though a Script virus trouble which resulted in my need to blow away (reformat) the HD and install all my programs under license and all the drivers from scratch.

    How to make a disk Image of my drive C and also a bootable CD Windows, in which case I have to do this again?

    You hope that it works?

    The day you have your backup/restore tools to work is not the day to know that they don't.

    Why not make a little test... pretend that your system does not start for some reason unknown and impossible to fix and to do the image you have created to recover.

    With the stuff you have since your last operation (a picture that is stored somewhere and a bootable CD), you can at least run a test to see if you can boot from the CD, and then if you can get there far enough, see if you can at least access the images you created.

    Of course, you don't have to actually restore the image - just make sure that you can boot from the CD you have done, and from there, you can at least navigate to and find the image that you created and do things at the point choose to restore your system from this image.

    Have you checked that you can at least get there?

    I use Macrium Reflect (the free version) and keep my images on an external drive.

    I made a bootable USB drive using Macrium.

    To make me feel better about all of this, I started my system on the USB and from there I could navigate to and view system images stored on my external hard drive and could choose to restore the last picture, if I wanted to.

    Of course I didn't really want to restore that image, but at least I got far enough along to believe that if I ever need to restore from an image at least I had something that I could start now and at least find my backup of images in case I ever need to use.

    Will it really work if I ever need to use it?  The only way to know for sure would be to actually try it and see and I could do it one day, but at least it looks promising.

    If you are using built in tools MS you could do the same kind of test and if you encounter a problem and it does not you can understand what is the problem and see if you can remedy.

    Another thing to consider is that if you have a problem with the MS tools and come to this community help I think that it is extremely unlikely that you will find a lot of help with the exception of the most fundamental aspects.  Microsoft has committed that 'experts' alleged Support Engineer here seem unable to solve even the simplest problems.

    If you need assistance with your backup/restore operation I don't think you're going to get a lot of Microsoft because Microsoft is not in the business of backup/restore.  This isn't what they are doing and is not their area of expertise.  You will probably get the best help in using the tools of the companies working in the areas of backup/restore, that's all they do and that's what they are doing throughout the day.

    In these communities of MS, volunteers are always your most reliable resource for solving problems.

  • How to make a picture with the webcam on my Dell laptop

    I have a webcam built-in to my computer dell laptop and want to take a picture of me and save it in the folder my pictures.  I have no idea as to where to look much less take a picture.

    Hello

    What is the brand and model of the laptop?

    I suggest you to check if the steps help like different laptops come with different software.

    (a) click Start

    (b) click on all programs

    (c) click Dell Webcam

    (d) click on Webcam Central to start the program.

    Another simple method to find the webcam is any webcam in the tab "search" start and click the result.

    The recorded images are usually located inside the library under the images.

    Hope this helps and keep us posted.

  • How to make a picture of the email to my library of images?

    I got photos in an email - I'd like to put in my library of images

    In Windows Live Mail... simply select (highlight) the
    message and go to the... File / save attachments.

  • How to make a picture from the bottom of my navigation bar?

    I have a navigation bar in my head and I want to add a background to fit good. How do I do that?

    Thank you.

    www.kurtesposito.com

    You can use CSS3 to do this:

    • Rounded corners
    • Linear gradient

    Use http://www.css3generator.com/ to generate your CSS code, so you can ask that your CSS.

  • How to make a picture that I put on my printer in my computer?

    How to make a picture that I put on my printer in my computer?

    The easiest way is to use a scanner to scan the picture.  Of course if you don't have a scanner, so it is more problematic.  Another way would be to have someone take a photo of the print with a digital camera and upload the image on your computer or on ancestry.com for you.  Take a photo of the print is not the best and takes some skill, but it's a way.  You can also take the printout to a place of photo processing.  If you live in the United States, then Wlagreens, Wal-Mart or a similar place probably can scan the photo for you put the results scanned on a CD or a flash drive for you, then use the results to ancestry.com.

    BTW: One of her grandchildren have to do for you.  If it's done before you know what happened.  We old people have to stick together and help each other, good luck!

  • How to attach a picture to the default email

    How to attach a picture to the default email

    Since the iPhone user Guide:

    http://help.Apple.com/iPhone/9/#/iph3caef30a

  • How to make a folder shows the number of files in there?

    How to make a folder shows the number of files in there?

    You have not indicated what OS you are using.

    Yosemite

    Action > View Options: Select to display the item of information

  • I'm trying to connect on Apple TV.  It keeps generating a 6-digit verification code, sent to another device.  I need a 4 digit or need to know how to make a space on the verification code entry screen

    I'm trying to connect on Apple TV.  It keeps generating a 6-digit verification code, sent to another device.  I need a 4 digit or need to know how to make a space on the verification code entry screen

    Read this noting the last two paragraphs:

    For Apple ID - Apple Support two-factor authentication

    You can try to add on your suggested such password or disable the service and then connect.

  • How to make an arch on the topic title?

    How to make an arch on the topic title?

    You can do the following entirely in any version of Pages because the text on a path is not supported. The News Gothic 'gate' in one area of text Pages. The arc of text was done in HTML5 Canvas with Javascript, then saved as a .png image, which was dragged/dropped into Pages v5.6.1. Normal means to create text curvilinear (CRA) is done by an application chart non-Apple.

  • How can I put pictures in the most recent at the top of the screen while I scroll more recent instead of to the top?

    How can I put pictures in the most recent at the top of the screen while I scroll more recent instead of to the top?

    The album "All Photos" can only be sorted by date, oldest first.

    But you can create your own album of all the Photos in a smart album, which keeps all the photoss. A custom Smarta album can be sorted in descending order, most recent photos first.

    My album ' my photo all the "custom is defined as: a rule 'Date is after', with a date range beginning well before the oldest photo in the library, then everything will be included, and I added a"Photo is not hidden,"so hidden photos will be excluded.

    To sort descending album ctrl-click in the sidebar and value 'out' 'Keep sorted by date, most recent first':

  • How to make a lock off the internet so I can have another WiFi computer using the internet

    How to make a lock off the internet so I can have another WiFi computer using the internet

    you do not take the lock itself.

    Instead, you configure another computer with security information to access the connection Wireless secure.

    Unfortunately, we cannot help you with this, because we cannot tell if you are the owner of the wireless connection or someone trying to hack it via another computer.

    However, what you can try is to contact technical support that provides your internet service.  they will be well to validate your identity and then provide help or more detailed instructions.

  • the friends hyii UA HUD need help how to make a backup of the files from his deleted with (shift + delete) memory card

    the friends hyii UA HUD need help how to make a backup of the files from his deleted with (shift + delete) memory card

    Hello

    It seems that you want to restore the files removed from the memory card.

    I will definitely help you with this.

    I would say you can search the Internet for data recovery software by using your favorite search engine.

    Warning: Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

    It will be useful. If you have any other questions, feel free to let us know. We will be happy to help you.

    Thank you.

  • How to make a backup of the system files?

    I want to just back up the filesystem in the case where.

    Hello

    You can save your own personal files (documents, photos, etc.) or do a complete PC backup that contains the system files.

    If you want to make a complete PC Backup or a backup file only, buy an external hard drive.

    Only Vista professional, comprehensive and company have the opportunity to make complete backups of PC.

    All editions of Vista can do backups of files.

    Here's how to back up and restore your files:

    "How to back up your data.

    http://www.wintuts.com/how-to-backup-your-data

    http://www.home-PC-help.com/windowsvistabackup.html

    "How to restore your files.

    http://www.wintuts.com/how-to-restore-files

    This is how to do a full backup of the computer and how to restore it (for Vista Business, Ultimate and Enterprise only):

    «How to make a backup of the computer in Vista»

    http://www.bleepingcomputer.com/tutorials/how-to-use-Vista-complete-PC-Backup/

    "How to restore a full backup of the computer.

    http://www.bleepingcomputer.com/tutorials/Windows-Vista-complete-PC-Restore/

    FAQ from Microsoft about backup and restore:

    "Back up and restore: frequently asked questions.

    http://Windows.Microsoft.com/en-us/Windows-Vista/back-up-and-restore-frequently-asked-questions

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

    There are a number of 3rd party programs available for a full backup of the computer; others, you must pay for, some are free.

    This program must be purchased:

    "Acronis True Image".

    http://www.Acronis.com/homecomputing/products/TrueImage/index_gwo.html?utm_expid=4274314-6

    These are free programs for the protection of the computer:

    "EaseUS Todo Backup free"

    http://www.TODO-backup.com/products/home/free-backup-software.htm

    "Download Backup & Recovery 2012 free FREE!

    http://www.Paragon-Software.com/home/BR-free/download.html

    «Macrium Reflect FREE Edition»

    http://www.Macrium.com/reflectfree.aspx

    ___________________________________________________

    And if you do not score a manufacturer of recovery on your hard drive, you should be able to make your own recovery discs that are system files in order to reinstall the operating system.

    Go to programs > name of the manufacturer of your computer > then their system or recovery tools software topics for them, depending on how it is formulated.

    If you can't find any reference to it, contact the manufacturer for advice on how to make these recovery disks.

    See you soon.

Maybe you are looking for