How to send mail from Oracle APEX

In this tutorial, I will show you how to send mail from Oracle APEX. Let’s start…

This tutorial divide into tree parts-

  1. Configure mail server
  2. Enabling network services
  3. Test mail

1. Configure mail server: Before you configure Oracle APEX mail server you need to a SMTP mail server username and password. Then login your oracle apex admin panel. After login Oracle APEX admin panel then go to manage instance > instance settings > mail.

Screenshot

Configure mail server as below:

Application Express Instance URL: APEX base URL
Application Express Images URL: APEX static file location
SMTP Host Address: Host server (eg. smtp.example.com)
SMTP Host Port: Mail server port (eg. 25)
SMTP Authentication Username: your mail server username
SMTP Authentication Password: your mail server password	
Use SSL/TLS: Optional
Default Email From Address: Optional
Maximum Emails per Workspace: Optional

2. Enabling Network Service: By default, the ability to interact with network services is disabled in Oracle Database 11g or later. Therefore, you must use the BMS_NETWORK_ACL_ADMIN package to grant connect privileges to any host for the database user. In this tutorial i will create network service for APEX 4.x power user that means APEX_040200 (Power user for APEX 5 is APEX_050000):

DECLARE
  ACL_PATH VARCHAR2(4000);
BEGIN
    -- Look for the ACL currently assigned to '*' and give APEX_040200
    -- the "connect" privilege if APEX_040200
    -- does not have the privilege yet.
  SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
    WHERE HOST = '*' AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL;
  IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE (ACL_PATH,'APEX_040200','connect') IS NULL THEN
    DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,'APEX_040200', TRUE, 'connect');
  END IF;
  EXCEPTION
    -- When no ACL has been assigned to '*'.
  WHEN NO_DATA_FOUND THEN
    DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml',
    'ACL that lets power users to connect to everywhere',
    'APEX_040200', TRUE, 'connect');
  DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*');
END;
/
COMMIT;

3. Send Mail: Oracle application express send mail using APEX_MAIL package. example…

APEX_MAIL.SEND(
        p_to        => 'email@gmail.com',
        p_from      => 'email2@oracle.com',
        p_subj      => 'APEX_MAIL with attachment',
        p_body      => 'Please review the attachment.',
        p_body_html => '<b>Please</b> review the attachment');
/

Send mail with attachments…

DECLARE
    l_id Number;
    x varchar2(100);
    y BLOB;
    z varchar2(100);
BEGIN
    l_id := APEX_MAIL.SEND(
        p_to        => 'email@gmail.com',
        p_from      => 'email2@oracle.com',
        p_subj      => 'APEX_MAIL with attachment',
        p_body      => 'Please review the attachment.',
        p_body_html => '<b>Please</b> review the attachment');

    SELECT FILENAME, IMAGE, MIMETYPE into x, y, z
        FROM CUSTOMER
        WHERE CUSTOMER_ID = 100;

        APEX_MAIL.ADD_ATTACHMENT(
            p_mail_id    => l_id,
            p_attachment => y,   -- BLOB column name
            p_filename   => x,   -- File Name 
            p_mime_type  => z);  -- MIME column name
END;
/

Thanks for visit. Happy apexing……

Published by

Ali Asgor

Graduate in GES, OCP holder, Self-motivated app developer, Programming lover, Lazy person...

151 thoughts on “How to send mail from Oracle APEX”

    1. If u use gmail as mail server, then configuration like
      SMTP server: smtp.gmail.com
      SMTP username: Your full gmail address (e.g. example@gmail.com)
      SMTP password: Your Gmail password
      SMTP port: 465

      Or if own mail server, then configure like
      SMTP server: mail.yourdomain.com or smtp.yourdomain.com
      SMTP username: Your full email address (e.g. example@yourdomain.com)
      SMTP password: Your email password
      SMTP port: 25/26

      1. Does this only need to apply to the original server?
        Such as mine if I am building it, or will it need to change with the server it is on?
        My users use many different servers between themselves.

  1. Dear !
    But i got error : ORA-29024: Certificate validation failure
    I use zoho mail. and port 465 (SSL)

    How to resolve it? Could you help me?
    Thanks

    1. You need to install a certificate on APEX Admin panel. U can use oracle wallet manager to install a certificate. Settings through Manage Instance > Instance Setting > Wallet

  2. I’m getting this error
    ORA-29279: SMTP permanent error: 530 5.7.0 Must issue a STARTTLS command first. f2sm21861492wjr.2 – gsmtp

    My Apex Release is 4.2.6 and Database 11.2.0

  3. I am using it on
    * Application Express Instance URL : http://localhost::8181/ords
    * Application Express Images URL : http://localhost:8181/i/
    * SMTP Host Address : localhost
    * SMTP Host Port : 25
    * SMTP Authentication Username :
    * SMTP Authentication Password :
    * Use SSL/TLS : No
    * Default Email From Address :
    * Maximum Emails per Workspac : 1000
    Error : Manage Instance -> Mail Queue
    ORA-29278: SMTP transient error: 421 Service not available

  4. ERROR at line 1:
    ORA-20001: This procedure must be invoked from within an ap
    ORA-06512: at “APEX_050000.WWV_FLOW_MAIL”, line 562
    ORA-06512: at “APEX_050000.WWV_FLOW_MAIL”, line 588
    ORA-06512: at “APEX_050000.WWV_FLOW_MAIL_API”, line 97

  5. Have you ever considered writing an e-book or guest authoring on other sites?
    I have a blog centered on the same ideas you discuss and would really like to have you share some stories/information. I
    know my viewers would enjoy your work. If you’re even remotely interested, feel free to send me an e-mail.

  6. After going over a handful of the blog articles on your site, I honestly like your way of writing a blog.
    I saved as a favorite it to my bookmark site list and will be checking back soon. Please check out my website as well and
    let me know how you feel.

  7. It’s the best time to make some plans for the future and it’s time
    to be happy. I’ve read this post and if I could I want to suggest
    you few interesting things or suggestions. Perhaps you can write next articles referring to this
    article. I desire to read more things about it!

  8. I was suggested this web site by my cousin. I’m not sure whether this
    post is written by him as no one else know such detailed about my problem.
    You are amazing! Thanks!

  9. Ніǃ
    Ι aрplaud women who havе the cоurаge tо enjоу thе lоvе of mаny wоmen and сhоoѕe the оnе who will bе her best frіеnd during thе bumpy аnd crаzу thing called lіfe.
    Ι wаnted to be that frіеnd, not ϳust thе stablе, rеliablе, bоrіng housewife of an ordіnаry marrіed соuрle.
    I am 22 уeаrs оld, Νorа, from Denmark.
    Μy profile iѕ here: http://igarcitnemicent.tk/zpg-8436/

  10. Good day I am so excited I found your website, I really
    found you by accident, while I was browsing on Google for something else, Anyhow I am here
    now and would just like to say many thanks for a marvelous post and
    a all round exciting blog (I also love the theme/design), I don’t have time to look
    over it all at the moment but I have bookmarked it and also added in your RSS feeds, so when I have
    time I will be back to read much more, Please do keep up the excellent work.

    Feel free to surf to my blog – fx마진거래 (Viola)

  11. ZAHRY MACHINERY EQUIPMENT LLC> offers a comprehensive range of industrial equipment for various industries. We provide reliable solutions to meet the needs of our customers, ensuring their satisfaction with our products and services. Our company is dedicated to delivering exceptional value and service to our customers.

  12. Hi! This is my first comment here so I just wanted to give a quick shout out and say I truly enjoy reading through your blog posts. Can you suggest any other blogs/websites/forums that cover the same topics? Thanks!
    pay id casino

  13. Aviator Spribe играть с друзьями казино
    It agree, rather useful message
    Добро пожаловать в захватывающий мир авиаторов! Aviator – это увлекательная игра, которая позволит вам окунуться в атмосферу боевых действий на небе. Необычные графика и захватывающий сюжет сделают ваше путешествие по воздуху неповторимым.

    Играйте в Aviator Spribe играть и получайте удовольствие от игры вместе с нами уже сегодня!
    Aviator игра позволит вам почувствовать себя настоящим пилотом. Вам предстоит совершить невероятные маневры, выполнять сложные задания и сражаться с противниками. Улучшайте свой самолет, чтобы быть готовым к любым ситуациям и становиться настоящим мастером.
    Основные особенности Aviator краш игры:
    1. Реалистичная графика и физика – благодаря передовой графике и реалистичной физике вы почувствуете себя настоящим пилотом.
    2. Разнообразные режимы игры и миссии – в Aviator краш игре вы сможете выбрать различные режимы игры, такие как гонки, симулятор полетов и захватывающие воздушные бои. Кроме того, каждая миссия будет предлагать свои собственные вызовы и задачи.
    3. Улучшение и модернизация самолетов – в игре доступны различные модели самолетов, которые можно покупать и улучшать. Вы сможете устанавливать новое оборудование, улучшать двигательность и мощность своего самолета, а также выбирать различные варианты окраски и декорации.
    Aviator краш игра – это возможность испытать себя в роли авиатора и преодолеть все сложности и опасности воздушного пространства. Почувствуйте настоящую свободу и адреналин в Aviator краш игре онлайн!
    Играйте в «Авиатор» в онлайн-казино Pin-Up
    Aviator краш игра онлайн предлагает увлекательную и захватывающую игровую атмосферу, где вы становитесь настоящим авиатором и сражаетесь с самыми опасными искусственными интеллектами.
    В этой игре вы должны показать свое мастерство и смекалку, чтобы преодолеть сложности многочисленных локаций и уровней. Вам предстоит собирать бонусы, уклоняться от препятствий и сражаться с врагами, используя свои навыки пилотирования и стрельбы.
    Каждый уровень игры Aviator краш имеет свою уникальную атмосферу и задачи. Будьте готовы к неожиданностям, так как вас ждут захватывающие повороты сюжета и сложные испытания. Найдите все пути к победе и станьте настоящим героем авиатором!
    Авиатор игра является прекрасным способом провести время и испытать настоящий адреналиновый разряд. Готовы ли вы стать лучшим авиатором? Не упустите свой шанс и начните играть в Aviator краш прямо сейчас!
    Aviator – играй, сражайся, побеждай!
    Aviator Pin Up (Авиатор Пин Ап ) – игра на деньги онлайн Казахстан
    Aviator игра предлагает увлекательное и захватывающее разнообразие врагов и уровней, которые не оставят равнодушными даже самых требовательных геймеров.
    Враги в Aviator краш игре онлайн представлены в самых разных формах и размерах. Здесь вы встретите группы из маленьких и быстрых врагов, а также огромных боссов с мощным вооружением. Разнообразие врагов позволяет игрокам использовать разные тактики и стратегии для победы.
    Кроме того, Aviator игра предлагает разнообразие уровней сложности. Выберите легкий уровень, чтобы насладиться игровым процессом, или вызовите себе настоящий вызов, выбрав экспертный уровень. Независимо от выбранного уровня сложности, вы получите максимум удовольствия от игры и окунетесь в захватывающий мир авиаторов.
    Играйте в Aviator и наслаждайтесь разнообразием врагов и уровней, которые позволят вам почувствовать себя настоящим авиатором.

  14. Usually I don’t read post on blogs, but I would like to say that this write-up very forced me to try and do it! Your writing style has been surprised me. Thanks, quite nice article.

  15. I would like to thnkx for the efforts you’ve put in writing this web site. I’m hoping the same high-grade web site post from you in the upcoming also. In fact your creative writing abilities has encouraged me to get my own website now. Really the blogging is spreading its wings quickly. Your write up is a great example of it.

  16. Hey there I am so delighted I found your web site, I really found you by mistake, while I was searching on Bing for something else, Nonetheless I am here now and would just like to say thanks a lot for a fantastic post and a all round entertaining blog (I also love the theme/design), I don’t have time to browse it all at the minute but I have book-marked it and also added in your RSS feeds, so when I have time I will be back to read more, Please do keep up the superb work.
    booi casino no deposit bonus codes 2022

  17. Right here is the perfect site for anybody who would like to find out about this topic. You know a whole lot its almost hard to argue with you (not that I personally would want to…HaHa). You certainly put a brand new spin on a subject which has been written about for a long time. Great stuff, just great!
    bonus code for club world online casino

  18. Thanks for your post. What I want to comment on is that when you are evaluating a good internet electronics go shopping, look for a web site with comprehensive information on critical factors such as the security statement, basic safety details, any payment methods, and other terms and policies. Continually take time to look at help in addition to FAQ pieces to get a far better idea of how the shop is effective, what they are able to do for you, and exactly how you can make the most of the features.

  19. Its such as you read my thoughts! You seem to know a lot about this, such as you
    wrote the e book in it or something. I believe that you just could
    do with some p.c. to drive the message house a bit,
    however other than that, that is great blog. A fantastic
    read. I’ll certainly be back.

  20. I do love the way you have framed this situation plus it does indeed provide me personally some fodder for thought. However, from everything that I have witnessed, I really wish when the remarks stack on that individuals keep on issue and in no way start on a tirade associated with some other news of the day. Anyway, thank you for this exceptional piece and even though I do not really go along with this in totality, I respect your standpoint.

  21. Heya i抦 for the first time here. I came across this board and I find It truly helpful & it helped me out much. I’m hoping to give one thing back and help others like you helped me.

  22. Thanks , I have just been searching for information about this topic for ages and yours is the greatest I have discovered so far. But, what about the conclusion? Are you sure about the source?

  23. I抎 must check with you here. Which is not something I usually do! I get pleasure from reading a post that can make folks think. Additionally, thanks for allowing me to remark!

  24. I needed to post you one tiny note to finally give thanks the moment again for the lovely tactics you have provided on this site. This has been simply wonderfully open-handed of you to convey unhampered what exactly many individuals would’ve made available for an ebook to make some cash for their own end, and in particular seeing that you might well have done it in case you desired. Those inspiring ideas in addition served like a good way to fully grasp that many people have the same zeal just as mine to know way more in terms of this problem. Certainly there are a lot more fun times ahead for individuals that read your blog post.

  25. The core of your writing whilst appearing reasonable originally, did not really settle well with me personally after some time. Someplace throughout the sentences you actually were able to make me a believer unfortunately just for a short while. I however have a problem with your jumps in assumptions and one might do nicely to help fill in those gaps. If you can accomplish that, I will surely end up being amazed.

  26. I do agree with all of the ideas you have presented in your post. They are really convincing and will definitely work. Still, the posts are very short for novices. Could you please extend them a little from next time? Thanks for the post.

  27. I have been exploring for a little for any high quality articles or weblog posts in this kind of house . Exploring in Yahoo I ultimately stumbled upon this website. Reading this info So i am satisfied to show that I have an incredibly good uncanny feeling I came upon exactly what I needed. I so much undoubtedly will make sure to don抰 fail to remember this website and provides it a glance regularly.

  28. Hey would you mind letting me know which hosting company you’re working with? I’ve loaded your blog in 3 different browsers and I must say this blog loads a lot quicker then most. Can you suggest a good web hosting provider at a honest price? Thanks a lot, I appreciate it!

  29. I do accept as true with all the ideas you have offered on your post.
    They are very convincing and can certainly work.
    Still, the posts are very short for novices. Could
    you please prolong them a bit from next time? Thanks for the post.

  30. Thanks for these tips. One thing I should also believe is the fact credit cards giving a 0 monthly interest often appeal to consumers in with zero rate, instant acceptance and easy online balance transfers, but beware of the main factor that will probably void your 0 easy streets annual percentage rate plus throw you out into the terrible house quick.

  31. Excellent beat ! I wish to apprentice whilst you amend your site, how can i subscribe for a blog website? The account aided me a applicable deal. I were a little bit acquainted of this your broadcast provided vibrant clear idea

  32. One thing I want to discuss is that weightloss program fast may be accomplished by the proper diet and exercise. Ones size not just affects appearance, but also the quality of life. Self-esteem, major depression, health risks, in addition to physical capabilities are impacted in putting on weight. It is possible to do everything right and at the same time having a gain. In such a circumstance, a problem may be the culprit. While excessive food and never enough physical exercise are usually accountable, common health conditions and widely used prescriptions can easily greatly help to increase size. I am grateful for your post here.

  33. A different issue is really that video gaming has become one of the all-time main forms of fun for people of nearly every age. Kids have fun with video games, and adults do, too. The XBox 360 has become the favorite games systems for folks who love to have hundreds of activities available to them, as well as who like to experiment with live with other folks all over the world. Many thanks for sharing your notions.

  34. hi!,I really like your writing very a lot! proportion we be in contact extra about your post on AOL? I need a specialist on this house to unravel my problem. May be that is you! Taking a look ahead to peer you.

  35. Good day! I know this is somewhat off topic but I was
    wondering which blog platform are you using for this website?
    I’m getting sick and tired of WordPress because I’ve had problems with hackers and I’m
    looking at options for another platform. I would be great if you
    could point me in the direction of a good platform.

  36. Hi there, I found your web site via Google while looking for a related topic, your website came up, it looks good. I have bookmarked it in my google bookmarks.

  37. Hiya, I’m really glad I have found this information. Today bloggers publish only about gossips and web and this is actually irritating. A good blog with exciting content, that’s what I need. Thank you for keeping this site, I’ll be visiting it. Do you do newsletters? Cant find it.

  38. A powerful share, I just given this onto a colleague who was doing slightly evaluation on this. And he in reality bought me breakfast as a result of I found it for him.. smile. So let me reword that: Thnx for the deal with! But yeah Thnkx for spending the time to discuss this, I feel strongly about it and love studying extra on this topic. If possible, as you turn into expertise, would you mind updating your blog with extra particulars? It’s highly helpful for me. Massive thumb up for this blog submit!

  39. Авиатор Спраб
    Добро пожаловать в захватывающий мир авиаторов! Aviator – это увлекательная игра, которая позволит вам окунуться в атмосферу боевых действий на небе. Необычные графика и захватывающий сюжет сделают ваше путешествие по воздуху неповторимым.
    Aviator Spribe бонус казино

  40. Aviator Spribe играть на тенге казино
    Добро пожаловать в захватывающий мир авиаторов! Aviator – это увлекательная игра, которая позволит вам окунуться в атмосферу боевых действий на небе. Необычные графика и захватывающий сюжет сделают ваше путешествие по воздуху неповторимым.
    Aviator Spribe играть на рубли казино

  41. Awesome blog! Is your theme custom made or did you download it from somewhere? A theme like yours with a few simple tweeks would really make my blog shine. Please let me know where you got your theme. Thank you

  42. Aviator Spribe играть демо
    Добро пожаловать в захватывающий мир авиаторов! Aviator – это увлекательная игра, которая позволит вам окунуться в атмосферу боевых действий на небе. Необычные графика и захватывающий сюжет сделают ваше путешествие по воздуху неповторимым.
    Aviator Spribe играть на евро казино

  43. An impressive share! I’ve just forwarded this onto a coworker who had been doing a little homework on this. And he actually ordered me dinner because I discovered it for him… lol. So let me reword this…. Thank YOU for the meal!! But yeah, thanks for spending some time to discuss this issue here on your site.
    writing service

  44. Hi there! Do you know if they make any plugins to assist with SEO? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good success. If you know of any please share. Cheers!

  45. Thank you for another wonderful post. Where else could anyone get that type of info in such a perfect way of writing? I’ve a presentation next week, and I’m on the look for such info.

  46. Pingback: porna
  47. I have been exploring for a little for any high quality articles or blog posts on this sort of space . Exploring in Yahoo I at last stumbled upon this website. Studying this info So i am happy to exhibit that I’ve a very good uncanny feeling I discovered exactly what I needed. I most certainly will make certain to do not overlook this web site and provides it a glance on a relentless basis.

  48. Aw, this was a really nice post. In concept I wish to put in writing like this additionally ?taking time and actual effort to make a very good article?however what can I say?I procrastinate alot and by no means seem to get one thing done.

Leave a Reply to jaws Cancel reply

Your email address will not be published. Required fields are marked *