This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 30th, when you will be able to use this site as normal.

    Forum Stats

  • 3,889,926 Users
  • 2,269,775 Discussions
  • 7,916,823 Comments

Discussions

APEX_MAIL add image to content

meedo1
meedo1 Member Posts: 15
edited Nov 25, 2016 9:36AM in APEX Discussions

Hi!

I want to send mail with base64 image in HTML content but when I recieve that mail img tag is empty.

My code:

begin  apex_mail.send(        p_to => 'TO_MAIL',        p_from => 'FROM_MAIL',        p_body => 'Image test',        p_body_html => 'Image:<br /><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAZCAAAAAB8j9M3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACeSURBVCjPxdIhFoAgDAbgRaLRyHE8gtFo9AZGjmDkGByNiLKJbjCfNv8GfMBjDNKHwB8oWKBY/4hCBywtRNRDHQkRHbMzDR2HW43uba5lLRKQri2ofVWcsjK+IHMMlJcjMwU59ahz4Srmw1EpcJR3rArqOUqLojz+1XyjONSKCIy8C1BdNfblw8coWgWVDAnRT1Q8hcimY4yJv3r8JTsvu7MOMQUglAAAAABJRU5ErkJggg==" />',        p_subj => 'Image test'  );    apex_mail.push_queue();end;

Is this possible with apex_mail?

Tagged:
Mahmoud_Rabie

Best Answer

  • Mahmoud_Rabie
    Mahmoud_Rabie Cloud Solution Architect | Technical Consultant | Trainer Saudi Arabia, RiyadhMember Posts: 3,216 Bronze Crown
    edited Nov 24, 2016 11:23AM Answer ✓

    Hi Meedo1

    Did you try the following code

    declare  l_body clob;  l_body_html clob;begin    l_body := 'Image test';  l_body_html :=  '<html><body>' || utl_tcp.crlf ||                   '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAZCAAAAAB8j9M3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACeSURBVCjPxdIhFoAgDAbgRaLRyHE8gtFo9AZGjmDkGByNiLKJbjCfNv8GfMBjDNKHwB8oWKBY/4hCBywtRNRDHQkRHbMzDR2HW43uba5lLRKQri2ofVWcsjK+IHMMlJcjMwU59ahz4Srmw1EpcJR3rArqOUqLojz+1XyjONSKCIy8C1BdNfblw8coWgWVDAnRT1Q8hcimY4yJv3r8JTsvu7MOMQUglAAAAABJRU5ErkJggg==" >'  || utl_tcp.crlf ||                  '</body></html>';  apex_mail.send(          p_to => 'TO_MAIL',          p_from => 'FROM_MAIL',          p_body => l_body,          p_body_html => l_body_html,          p_subj => 'Image test'    );    apex_mail.push_queue();  end;

    I hope that help or solves your problem

    Regards

    Mahmoud

Answers

  • Mahmoud_Rabie
    Mahmoud_Rabie Cloud Solution Architect | Technical Consultant | Trainer Saudi Arabia, RiyadhMember Posts: 3,216 Bronze Crown
    edited Nov 24, 2016 11:23AM Answer ✓

    Hi Meedo1

    Did you try the following code

    declare  l_body clob;  l_body_html clob;begin    l_body := 'Image test';  l_body_html :=  '<html><body>' || utl_tcp.crlf ||                   '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAZCAAAAAB8j9M3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACeSURBVCjPxdIhFoAgDAbgRaLRyHE8gtFo9AZGjmDkGByNiLKJbjCfNv8GfMBjDNKHwB8oWKBY/4hCBywtRNRDHQkRHbMzDR2HW43uba5lLRKQri2ofVWcsjK+IHMMlJcjMwU59ahz4Srmw1EpcJR3rArqOUqLojz+1XyjONSKCIy8C1BdNfblw8coWgWVDAnRT1Q8hcimY4yJv3r8JTsvu7MOMQUglAAAAABJRU5ErkJggg==" >'  || utl_tcp.crlf ||                  '</body></html>';  apex_mail.send(          p_to => 'TO_MAIL',          p_from => 'FROM_MAIL',          p_body => l_body,          p_body_html => l_body_html,          p_subj => 'Image test'    );    apex_mail.push_queue();  end;

    I hope that help or solves your problem

    Regards

    Mahmoud

  • meedo1
    meedo1 Member Posts: 15
    edited Nov 24, 2016 2:04PM

    Thank you. It works in Outlook, but in Gmail is still empty, but this is probably Google's problem?

    Mahmoud_RabieMahmoud_Rabie
  • Mahmoud_Rabie
    Mahmoud_Rabie Cloud Solution Architect | Technical Consultant | Trainer Saudi Arabia, RiyadhMember Posts: 3,216 Bronze Crown
    edited Nov 25, 2016 9:36AM
This discussion has been closed.