{"id":4361,"date":"2019-12-13T07:04:17","date_gmt":"2019-12-13T07:04:17","guid":{"rendered":"https:\/\/vinish.dev\/?p=4361"},"modified":"2025-04-16T19:49:06","modified_gmt":"2025-04-16T14:19:06","slug":"pl-sql-mail-client-api-examples","status":"publish","type":"post","link":"https:\/\/vinish.dev\/pl-sql-mail-client-api-examples","title":{"rendered":"Retrieve Messages from Mailbox Using PL\/SQL Mail_Client API"},"content":{"rendered":"<p>Recently I got the task to build a kind of mail client system in Oracle Apex. The requirement was to show the messages of mail Inbox on a page for a particular account so that the user can view the email messages, attachments and can delete the messages, etc. But in Oracle, there are packages to send emails using UTL_SMPT, UTL_MAIL, and APEX_MAIL, and there is no package to retrieve the mail messages from the mailbox. After searching a little bit, I found a PL\/SQL MAIL_CLIENT API written by Carsten Czarski, with which you can easily retrieve the messages from the mailbox. And in this tutorial, I am giving the examples of <strong>MAIL_CLIENT API<\/strong> commands and procedures. First, download and install <strong>PL\/SQL MAIL_CLIENT<\/strong> using the following link:<\/p>\r\n<p>Download PL\/SQL MAIL_CLIENT API<\/p>\r\n<h2>PL\/SQL MAIL_CLIENT API Examples<\/h2>\r\n<p>In the following sections, I am giving the step by step examples to connect using the MAIL_CLIENT package, then how to view mailbox contents, how to view a particular message and its attachments, etc.<\/p>\r\n<h3>Example-1: Connect Using MAIL_CLIENT<\/h3>\r\n<p>To connect to the mail server, use the following PL\/SQL code:<\/p>\r\n<pre>begin\r\n  mail_client.connect_server(\r\n    p_hostname =&gt; 'YourMailServer.com',\r\n    p_port     =&gt; YourPortIntegerValue,\r\n    p_protocol =&gt; mail_client.protocol_IMAP, -- or mail_client.protocol_POP3\r\n    p_userid   =&gt; 'YourUserID',\r\n    p_passwd   =&gt; 'YourPassword',\r\n    p_ssl      =&gt; true -- true or false depends on your mailbox\r\n  );\r\n\r\n  mail_client.open_inbox;\r\n  dbms_output.put_line('Mailbox successfully opened.');\r\n  dbms_output.put_line('The INBOX folder contains '||mail_client.get_message_count||' messages.');\r\nend;\r\n\/<\/pre>\r\n<p>Change the hostname, port, <a href=\"https:\/\/webutility.io\/blog\/web-api-protocol\">protocol<\/a>, user id, and password according to your mailbox settings. And after executing the above code you will be connected to your mailbox. Now definitely you want to view the contents of your inbox. Use the following command:<\/p>\r\n<h3>Example-2: View the Mailbox Contents<\/h3>\r\n<p>To view the mailbox contents using the PL\/SQL MAIL_CLIENT API, run the following SQL statement to view the messages latest on top:<\/p>\r\n<pre>select * from table(mail_client.get_mail_headers()) order by msg_number desc;<\/pre>\r\n<p>You will get the following columns from the above query:<\/p>\r\n<ul>\r\n<li>MSG_NUMBER<\/li>\r\n<li>SUBJECT<\/li>\r\n<li>SENDER<\/li>\r\n<li>SENDER_EMAIL<\/li>\r\n<li>SENT_DATE<\/li>\r\n<li>CONTENT_TYPE<\/li>\r\n<li>DELETED<\/li>\r\n<li>Some more flag columns<\/li>\r\n<\/ul>\r\n<h3>Example-3: Get the Structure of the Mail Message<\/h3>\r\n<p>The structure of a mail message contains the information, such as which <strong>PARTINDEX<\/strong> number contains the body part in plain text format, the body part in HTML format, and the attachments of the mail. Suppose you want to get the plain text of email body part run the following SQL queries:<\/p>\r\n<pre>select * from table(mail_client.get_message(1).get_structure());<\/pre>\r\n<p>The value 1 above is the <strong>MSG_NUMBER<\/strong> of the messages. It will give you the following information:<\/p>\r\n<ul>\r\n<li>PARTINDEX<\/li>\r\n<li>PARENTINDEX<\/li>\r\n<li>CONTENT_TYPE<\/li>\r\n<li>SIZE, etc.<\/li>\r\n<\/ul>\r\n\r\n<figure class=\"wp-block-table is-style-stripes\">\r\n<table class=\"has-subtle-pale-blue-background-color has-background\">\r\n<tbody>\r\n<tr>\r\n<td><strong>PARTINDEX<\/strong><\/td>\r\n<td><strong>PARENTINDEX<\/strong><\/td>\r\n<td><strong>CONTENT_TYPE<\/strong><\/td>\r\n<td><strong>SIZE<\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0,0<\/td>\r\n<td>0<\/td>\r\n<td>text\/plain<\/td>\r\n<td>2993<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0,1<\/td>\r\n<td>1<\/td>\r\n<td>text\/html<\/td>\r\n<td>94849<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>1<\/td>\r\n<td>1<\/td>\r\n<td>multipart\/report<\/td>\r\n<td>39398<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/figure>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\">Example-4: Retrieve the Message Body<\/h3>\r\n\r\n\r\n\r\n<p>Now for example, if you want to get the message body in plain text format for message number 1 run the following query:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">SELECT Mail_Client.Get_Message(1 \/* specify message number *\/).get_bodypart_content_varchar2('0,0')\r\n             FROM Dual;<\/pre>\r\n\r\n\r\n\r\n<p class=\"is-layout-flow wp-block-quote-is-layout-flow\"><strong>Note:<\/strong> <cite>The 0,0 above is the value of the PARTINDEX column for text\/plain content type. <\/cite><\/p>\r\n\r\n\r\n\r\n<p>To get the body in HTML format, we will run the following query with the <strong>PARTINDEX<\/strong> column value 0,1. It will return the body in <strong>CLOB<\/strong>:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">SELECT Mail_Client.Get_Message(1 \/* specify message number *\/).get_bodypart_content_clob('0,1')\r\n            FROM Dual;<\/pre>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\">Example-5: Get the Mail Attachment<\/h3>\r\n\r\n\r\n\r\n<p>Similarly, get the mail attachment using the <strong>PARTINDEX<\/strong> value 1 as the parameter, as shown in the below query:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">SELECT Mail_Client.Get_Message(1 \/* specify message number *\/).Get_Bodypart_Content_Blob('1')\r\n             FROM Dual;<\/pre>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\">Example-6: Delete a Mail Message<\/h3>\r\n\r\n\r\n\r\n<p>Below is the stored procedure example to delete the mail message, using the MAIL_CLIENT API.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">Create or Replace PROCEDURE Delete_Mail_Msg(i_Msg_Number IN NUMBER) IS\r\n     \r\nt_Msg Mail_t;\r\n\r\nBEGIN\r\n\r\nMail_Client.Connect_Server(p_Hostname =&gt; 'YourMailServer',\r\n                           p_Port     =&gt; MailServerPort,\r\n                           p_Protocol =&gt; Mail_Client.Protocol_Imap,\r\n                           p_Userid   =&gt; 'username',\r\n                           p_Passwd   =&gt; 'password',\r\n                           p_Ssl      =&gt; TRUE);\r\n\r\nMail_Client.Open_Inbox;\r\n\r\nt_Msg := Mail_Client.Get_Message(i_Msg_Number);\r\nt_Msg.Mark_Deleted();\r\n\r\nMail_Client.Expunge_Folder;\r\nMail_Client.Close_Folder;\r\nMail_Client.Disconnect_Server;\r\n\r\nEXCEPTION\r\n     WHEN OTHERS THEN\r\n       IF Mail_Client.Is_Connected() = 1 THEN\r\n         Mail_Client.Close_Folder;\r\n         Mail_Client.Disconnect_Server;\r\n       END IF;\r\n       Raise;\r\n   END Delete_Mail_Msg;<\/pre>\r\n\r\n\r\n\r\n<p>Now just call the above procedure to delete a specific mail message, passed as parameter. Below is the example:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">Begin\r\n   Delete_Mail_Msg(3);\r\nEnd;<\/pre>\r\n\r\n\r\n\r\n<p>The above call to procedure <strong>DELETE_MAIL_MSG<\/strong> will remove the email message number 3 from the server.<\/p>\r\n\r\n\r\n\r\n<p>Also, giving the example below to store all inbox messages to a table with the mail body and attachment. Follow these steps:<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\">Step-1: Create a Table.<\/h3>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">CREATE TABLE MAIL_INBOX (\r\nMSG_NUMBER INTEGER,\r\nSUBJECT VARCHAR2(4000),\r\nSENT_DATE DATE,\r\nSENDER_EMAIL,\r\nBODY_TEXT CLOB,\r\nMAIL_ATTACHMENT BLOB)\r\n\/<\/pre>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\">Step-2: Create an Oracle PL\/SQL Stored Procedure<\/h3>\r\n\r\n\r\n\r\n<pre>CREATE OR REPLACE PROCEDURE LOAD_EMAILS IS<br \/>    <br \/>    CURSOR c_Inbox IS<br \/>      SELECT Msg_Number,<br \/>             Subject,<br \/>             Sender,<br \/>             Sender_Email,<br \/>             Sent_Date,<br \/>             Content_Type<br \/>        FROM TABLE(Mail_Client.Get_Mail_Headers())<br \/>       ORDER BY Msg_Number DESC;<br \/>  <br \/>    c_Clob    CLOB;<br \/>    b_blob    BLOB;<br \/>  <br \/>    t_Msg Mail_t;<br \/>  <br \/>    v_Partindex VARCHAR2(100);<br \/>  BEGIN<br \/>  <br \/>    Mail_Client.Connect_Server(p_Hostname =&gt; 'YOURMAILSERVER',<br \/>                               p_Port     =&gt; YOURPORT,<br \/>                               p_Protocol =&gt; Mail_Client.Protocol_Imap,<br \/>                               p_Userid   =&gt; 'USERID',<br \/>                               p_Passwd   =&gt; 'PASSWORD',<br \/>                               p_Ssl      =&gt; TRUE);<br \/>  <br \/>    Mail_Client.Open_Inbox;<br \/>  <br \/>    FOR c IN c_Inbox LOOP<br \/><br \/>     Dbms_Lob.Createtemporary(Lob_Loc =&gt; c_Clob,<br \/>                                   Cache   =&gt; TRUE,<br \/>                                   Dur     =&gt; Dbms_Lob.Call);<br \/><br \/>      Dbms_Lob.Createtemporary(Lob_Loc =&gt; b_blob,<br \/>                                   Cache   =&gt; TRUE,<br \/>                                   Dur     =&gt; Dbms_Lob.Call);<br \/>      <br \/>      IF Substr(c.Content_Type,<br \/>                   1,<br \/>                   9) = 'multipart' THEN<br \/>        v_Partindex := NULL;<br \/>        BEGIN<br \/>          SELECT Partindex<br \/>            INTO v_Partindex<br \/>            FROM TABLE(Mail_Client.Get_Message(c.Msg_Number).Get_Structure())<br \/>           WHERE Substr(Content_Type,<br \/>                        1,<br \/>                        9) = 'text\/html';<br \/>        EXCEPTION<br \/>          WHEN OTHERS THEN<br \/>            NULL;<br \/>        END;<br \/>      <br \/>        IF v_Partindex IS NOT NULL THEN<br \/>        <br \/>          BEGIN<br \/>            SELECT Mail_Client.Get_Message(c.Msg_Number).Get_Bodypart_Content_Clob(v_Partindex)<br \/>              INTO c_Clob<br \/>              FROM Dual;<br \/>          EXCEPTION<br \/>            WHEN OTHERS THEN<br \/>              NULL;<br \/>          END;<br \/>          <br \/>                    BEGIN<br \/>            SELECT Mail_Client.Get_Message(c.Msg_Number).Get_Bodypart_Content_BLOB('1')<br \/>              INTO b_blob<br \/>              FROM Dual;<br \/>          EXCEPTION<br \/>            WHEN OTHERS THEN<br \/>              NULL;<br \/>          END;<br \/><br \/>        END IF;<br \/>        INSERT INTO mail_inbox<br \/>          (Msg_Number,<br \/>           Subject,<br \/>           Sent_Date,<br \/>           Sender_email,<br \/>           Body_Text,<br \/>           mail_attachment)<br \/>        VALUES<br \/>          (c.Msg_Number,<br \/>           c.Subject,<br \/>           c.Sent_Date,<br \/>           c.Sender_Email,<br \/>           c_Clob,<br \/>           b_blob);<br \/>      ELSIF Substr(c.Content_Type,<br \/>                   1,<br \/>                   9) = 'text\/html' THEN<br \/>      <br \/>        BEGIN<br \/>          SELECT Mail_Client.Get_Message(c.Msg_Number).Get_Content_Clob()<br \/>            INTO c_Clob<br \/>            FROM Dual;<br \/>        EXCEPTION<br \/>          WHEN OTHERS THEN<br \/>            NULL;<br \/>        END;<br \/>        <br \/>                INSERT INTO mail_inbox<br \/>          (Msg_Number,<br \/>           Subject,<br \/>           Sent_Date,<br \/>           Sender_email,<br \/>           Body_Text)<br \/>        VALUES<br \/>          (c.Msg_Number,<br \/>           c.Subject,<br \/>           c.Sent_Date,<br \/>           c.Sender_Email<br \/>           c_Clob);<br \/><br \/>      END IF;<br \/>    END LOOP;<br \/>    COMMIT;<br \/>    Mail_Client.Close_Folder;<br \/>    Mail_Client.Disconnect_Server;<br \/>  <br \/>  EXCEPTION<br \/>    WHEN OTHERS THEN<br \/>      ROLLBACK;<br \/>    <br \/>      IF Mail_Client.Is_Connected() = 1 THEN<br \/>        Mail_Client.Close_Folder;<br \/>        Mail_Client.Disconnect_Server;<br \/>      END IF;<br \/>      RAISE;<br \/><br \/>  END LOAD_EMAILS;<\/pre>\r\n<p>Run the above procedure to populate the table with email messages as follows:<\/p>\r\n<pre>Begin<br \/>   Load_Emails;<br \/>End;<\/pre>\r\n<p>Now you can query the table <strong>MAIL_INBOX<\/strong> to view the email messages.<\/p>\r\n<pre>Select * from mail_inbox;<\/pre>\r\n<div class=\"github_div\"><a href=\"https:\/\/github.com\/devvinish\/plsql-mail-client-example\" target=\"_blank\" rel=\"noopener noreferrer\">Download this project from GitHub<\/a><\/div>\r\n<h4>Related Tutorials:<\/h4>\r\n<ul>\r\n<li><a href=\"https:\/\/vinish.dev\/how-to-get-file-from-blob-in-oracle\">How to Get BLOB from File in PL\/SQL?<\/a><\/li>\r\n<li><a href=\"https:\/\/vinish.dev\/oracle-utl_smtp-send-mail-with-attachment-example-using-oracle-wallet-authentication\">Oracle UTL_SMTP: Send Mail with Attachment Example Using Oracle Wallet Authentication<\/a><\/li>\r\n<\/ul>\r\n","protected":false},"excerpt":{"rendered":"<p>Recently I got the task to build a kind of mail client system in Oracle Apex. The requirement was to show the messages of mail Inbox on a page for a particular account so that the user can view the email messages, attachments and can delete the messages, etc. But in Oracle, there are packages [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":16142,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-4361","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-plsql"],"blocksy_meta":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Retrieve Messages from Mailbox Using PL\/SQL Mail_Client API &#8226; Vinish.Dev<\/title>\n<meta name=\"description\" content=\"Learn how to retrieve mail messages using the PL\/SQL MAIL_CLIENT API. Examples covers, read email body text, attachment, and store all the inbox mails to a table.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vinish.dev\/pl-sql-mail-client-api-examples\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Retrieve Messages from Mailbox Using PL\/SQL Mail_Client API &#8226; Vinish.Dev\" \/>\n<meta property=\"og:description\" content=\"Learn how to retrieve mail messages using the PL\/SQL MAIL_CLIENT API. Examples covers, read email body text, attachment, and store all the inbox mails to a table.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vinish.dev\/pl-sql-mail-client-api-examples\" \/>\n<meta property=\"og:site_name\" content=\"Vinish.Dev\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/foxinfotech2014\" \/>\n<meta property=\"article:published_time\" content=\"2019-12-13T07:04:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-16T14:19:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/vinish.dev\/wp-content\/uploads\/2019\/12\/retrieve-messages-from-mailbox-using-plsql-mail_client-api.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"640\" \/>\n\t<meta property=\"og:image:height\" content=\"285\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Vinish Kapoor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/x.com\/vinish_kapoor\" \/>\n<meta name=\"twitter:site\" content=\"@foxinfotech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vinish Kapoor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/vinish.dev\\\/pl-sql-mail-client-api-examples#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/pl-sql-mail-client-api-examples\"},\"author\":{\"name\":\"Vinish Kapoor\",\"@id\":\"https:\\\/\\\/vinish.dev\\\/#\\\/schema\\\/person\\\/a7790479716d2a54131ca873f8483d3f\"},\"headline\":\"Retrieve Messages from Mailbox Using PL\\\/SQL Mail_Client API\",\"datePublished\":\"2019-12-13T07:04:17+00:00\",\"dateModified\":\"2025-04-16T14:19:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/pl-sql-mail-client-api-examples\"},\"wordCount\":633,\"commentCount\":11,\"publisher\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/#\\\/schema\\\/person\\\/df5e5ca816f6f4302efc03cf58dc97b4\"},\"image\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/pl-sql-mail-client-api-examples#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/vinish.dev\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/retrieve-messages-from-mailbox-using-plsql-mail_client-api.jpg\",\"articleSection\":[\"PLSQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/vinish.dev\\\/pl-sql-mail-client-api-examples#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/vinish.dev\\\/pl-sql-mail-client-api-examples\",\"url\":\"https:\\\/\\\/vinish.dev\\\/pl-sql-mail-client-api-examples\",\"name\":\"Retrieve Messages from Mailbox Using PL\\\/SQL Mail_Client API &#8226; Vinish.Dev\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/pl-sql-mail-client-api-examples#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/pl-sql-mail-client-api-examples#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/vinish.dev\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/retrieve-messages-from-mailbox-using-plsql-mail_client-api.jpg\",\"datePublished\":\"2019-12-13T07:04:17+00:00\",\"dateModified\":\"2025-04-16T14:19:06+00:00\",\"description\":\"Learn how to retrieve mail messages using the PL\\\/SQL MAIL_CLIENT API. Examples covers, read email body text, attachment, and store all the inbox mails to a table.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/pl-sql-mail-client-api-examples#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/vinish.dev\\\/pl-sql-mail-client-api-examples\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/vinish.dev\\\/pl-sql-mail-client-api-examples#primaryimage\",\"url\":\"https:\\\/\\\/vinish.dev\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/retrieve-messages-from-mailbox-using-plsql-mail_client-api.jpg\",\"contentUrl\":\"https:\\\/\\\/vinish.dev\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/retrieve-messages-from-mailbox-using-plsql-mail_client-api.jpg\",\"width\":640,\"height\":285,\"caption\":\"Retrieve Messages from Mailbox Using PL\\\/SQL Mail_Client API\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/vinish.dev\\\/pl-sql-mail-client-api-examples#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/vinish.dev\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PLSQL\",\"item\":\"https:\\\/\\\/vinish.dev\\\/category\\\/plsql\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Retrieve Messages from Mailbox Using PL\\\/SQL Mail_Client API\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/vinish.dev\\\/#website\",\"url\":\"https:\\\/\\\/vinish.dev\\\/\",\"name\":\"Vinish.Dev\",\"description\":\"Vinish Kapoor&#039;s Blog: Best Oracle Blog for Developers\",\"publisher\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/#\\\/schema\\\/person\\\/df5e5ca816f6f4302efc03cf58dc97b4\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/vinish.dev\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/vinish.dev\\\/#\\\/schema\\\/person\\\/df5e5ca816f6f4302efc03cf58dc97b4\",\"name\":\"Vinish Kapoor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/vinish.dev\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/vinishprofile.png\",\"url\":\"https:\\\/\\\/vinish.dev\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/vinishprofile.png\",\"contentUrl\":\"https:\\\/\\\/vinish.dev\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/vinishprofile.png\",\"width\":192,\"height\":192,\"caption\":\"Vinish Kapoor\"},\"logo\":{\"@id\":\"https:\\\/\\\/vinish.dev\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/vinishprofile.png\"},\"description\":\"Vinish Kapoor is a seasoned software development professional and a fervent enthusiast of artificial intelligence (AI). His impressive career spans over 25+ years, marked by a relentless pursuit of innovation and excellence in the field of information technology. As an Oracle ACE, Vinish has distinguished himself as a leading expert in Oracle technologies, a title awarded to individuals who have demonstrated their deep commitment, leadership, and expertise in the Oracle community.\",\"sameAs\":[\"https:\\\/\\\/vinish.dev\\\/\",\"https:\\\/\\\/www.facebook.com\\\/foxinfotech2014\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/vinish-kapoor\\\/\",\"https:\\\/\\\/x.com\\\/foxinfotech\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/vinish.dev\\\/#\\\/schema\\\/person\\\/a7790479716d2a54131ca873f8483d3f\",\"name\":\"Vinish Kapoor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a67232caa79b11f24f16c371866a96cfb575e011ebda6fa6e3d088a837a31bde?s=96&d=identicon&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a67232caa79b11f24f16c371866a96cfb575e011ebda6fa6e3d088a837a31bde?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a67232caa79b11f24f16c371866a96cfb575e011ebda6fa6e3d088a837a31bde?s=96&d=identicon&r=g\",\"caption\":\"Vinish Kapoor\"},\"description\":\"Vinish Kapoor is a seasoned software development professional and a fervent enthusiast of artificial intelligence (AI). His impressive career spans over 25+ years, marked by a relentless pursuit of innovation and excellence in the field of information technology. As an Oracle ACE, Vinish has distinguished himself as a leading expert in Oracle technologies, a title awarded to individuals who have demonstrated their deep commitment, leadership, and expertise in the Oracle community.\",\"sameAs\":[\"https:\\\/\\\/vinish.dev\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/vinish-kapoor\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/x.com\\\/vinish_kapoor\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Retrieve Messages from Mailbox Using PL\/SQL Mail_Client API &#8226; Vinish.Dev","description":"Learn how to retrieve mail messages using the PL\/SQL MAIL_CLIENT API. Examples covers, read email body text, attachment, and store all the inbox mails to a table.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vinish.dev\/pl-sql-mail-client-api-examples","og_locale":"en_US","og_type":"article","og_title":"Retrieve Messages from Mailbox Using PL\/SQL Mail_Client API &#8226; Vinish.Dev","og_description":"Learn how to retrieve mail messages using the PL\/SQL MAIL_CLIENT API. Examples covers, read email body text, attachment, and store all the inbox mails to a table.","og_url":"https:\/\/vinish.dev\/pl-sql-mail-client-api-examples","og_site_name":"Vinish.Dev","article_publisher":"https:\/\/www.facebook.com\/foxinfotech2014","article_published_time":"2019-12-13T07:04:17+00:00","article_modified_time":"2025-04-16T14:19:06+00:00","og_image":[{"width":640,"height":285,"url":"https:\/\/vinish.dev\/wp-content\/uploads\/2019\/12\/retrieve-messages-from-mailbox-using-plsql-mail_client-api.jpg","type":"image\/jpeg"}],"author":"Vinish Kapoor","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/x.com\/vinish_kapoor","twitter_site":"@foxinfotech","twitter_misc":{"Written by":"Vinish Kapoor","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vinish.dev\/pl-sql-mail-client-api-examples#article","isPartOf":{"@id":"https:\/\/vinish.dev\/pl-sql-mail-client-api-examples"},"author":{"name":"Vinish Kapoor","@id":"https:\/\/vinish.dev\/#\/schema\/person\/a7790479716d2a54131ca873f8483d3f"},"headline":"Retrieve Messages from Mailbox Using PL\/SQL Mail_Client API","datePublished":"2019-12-13T07:04:17+00:00","dateModified":"2025-04-16T14:19:06+00:00","mainEntityOfPage":{"@id":"https:\/\/vinish.dev\/pl-sql-mail-client-api-examples"},"wordCount":633,"commentCount":11,"publisher":{"@id":"https:\/\/vinish.dev\/#\/schema\/person\/df5e5ca816f6f4302efc03cf58dc97b4"},"image":{"@id":"https:\/\/vinish.dev\/pl-sql-mail-client-api-examples#primaryimage"},"thumbnailUrl":"https:\/\/vinish.dev\/wp-content\/uploads\/2019\/12\/retrieve-messages-from-mailbox-using-plsql-mail_client-api.jpg","articleSection":["PLSQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/vinish.dev\/pl-sql-mail-client-api-examples#respond"]}]},{"@type":"WebPage","@id":"https:\/\/vinish.dev\/pl-sql-mail-client-api-examples","url":"https:\/\/vinish.dev\/pl-sql-mail-client-api-examples","name":"Retrieve Messages from Mailbox Using PL\/SQL Mail_Client API &#8226; Vinish.Dev","isPartOf":{"@id":"https:\/\/vinish.dev\/#website"},"primaryImageOfPage":{"@id":"https:\/\/vinish.dev\/pl-sql-mail-client-api-examples#primaryimage"},"image":{"@id":"https:\/\/vinish.dev\/pl-sql-mail-client-api-examples#primaryimage"},"thumbnailUrl":"https:\/\/vinish.dev\/wp-content\/uploads\/2019\/12\/retrieve-messages-from-mailbox-using-plsql-mail_client-api.jpg","datePublished":"2019-12-13T07:04:17+00:00","dateModified":"2025-04-16T14:19:06+00:00","description":"Learn how to retrieve mail messages using the PL\/SQL MAIL_CLIENT API. Examples covers, read email body text, attachment, and store all the inbox mails to a table.","breadcrumb":{"@id":"https:\/\/vinish.dev\/pl-sql-mail-client-api-examples#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vinish.dev\/pl-sql-mail-client-api-examples"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vinish.dev\/pl-sql-mail-client-api-examples#primaryimage","url":"https:\/\/vinish.dev\/wp-content\/uploads\/2019\/12\/retrieve-messages-from-mailbox-using-plsql-mail_client-api.jpg","contentUrl":"https:\/\/vinish.dev\/wp-content\/uploads\/2019\/12\/retrieve-messages-from-mailbox-using-plsql-mail_client-api.jpg","width":640,"height":285,"caption":"Retrieve Messages from Mailbox Using PL\/SQL Mail_Client API"},{"@type":"BreadcrumbList","@id":"https:\/\/vinish.dev\/pl-sql-mail-client-api-examples#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vinish.dev\/"},{"@type":"ListItem","position":2,"name":"PLSQL","item":"https:\/\/vinish.dev\/category\/plsql"},{"@type":"ListItem","position":3,"name":"Retrieve Messages from Mailbox Using PL\/SQL Mail_Client API"}]},{"@type":"WebSite","@id":"https:\/\/vinish.dev\/#website","url":"https:\/\/vinish.dev\/","name":"Vinish.Dev","description":"Vinish Kapoor&#039;s Blog: Best Oracle Blog for Developers","publisher":{"@id":"https:\/\/vinish.dev\/#\/schema\/person\/df5e5ca816f6f4302efc03cf58dc97b4"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vinish.dev\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/vinish.dev\/#\/schema\/person\/df5e5ca816f6f4302efc03cf58dc97b4","name":"Vinish Kapoor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vinish.dev\/wp-content\/uploads\/2023\/12\/vinishprofile.png","url":"https:\/\/vinish.dev\/wp-content\/uploads\/2023\/12\/vinishprofile.png","contentUrl":"https:\/\/vinish.dev\/wp-content\/uploads\/2023\/12\/vinishprofile.png","width":192,"height":192,"caption":"Vinish Kapoor"},"logo":{"@id":"https:\/\/vinish.dev\/wp-content\/uploads\/2023\/12\/vinishprofile.png"},"description":"Vinish Kapoor is a seasoned software development professional and a fervent enthusiast of artificial intelligence (AI). His impressive career spans over 25+ years, marked by a relentless pursuit of innovation and excellence in the field of information technology. As an Oracle ACE, Vinish has distinguished himself as a leading expert in Oracle technologies, a title awarded to individuals who have demonstrated their deep commitment, leadership, and expertise in the Oracle community.","sameAs":["https:\/\/vinish.dev\/","https:\/\/www.facebook.com\/foxinfotech2014","https:\/\/www.linkedin.com\/in\/vinish-kapoor\/","https:\/\/x.com\/foxinfotech"]},{"@type":"Person","@id":"https:\/\/vinish.dev\/#\/schema\/person\/a7790479716d2a54131ca873f8483d3f","name":"Vinish Kapoor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/a67232caa79b11f24f16c371866a96cfb575e011ebda6fa6e3d088a837a31bde?s=96&d=identicon&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a67232caa79b11f24f16c371866a96cfb575e011ebda6fa6e3d088a837a31bde?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a67232caa79b11f24f16c371866a96cfb575e011ebda6fa6e3d088a837a31bde?s=96&d=identicon&r=g","caption":"Vinish Kapoor"},"description":"Vinish Kapoor is a seasoned software development professional and a fervent enthusiast of artificial intelligence (AI). His impressive career spans over 25+ years, marked by a relentless pursuit of innovation and excellence in the field of information technology. As an Oracle ACE, Vinish has distinguished himself as a leading expert in Oracle technologies, a title awarded to individuals who have demonstrated their deep commitment, leadership, and expertise in the Oracle community.","sameAs":["https:\/\/vinish.dev\/","https:\/\/www.linkedin.com\/in\/vinish-kapoor\/","https:\/\/x.com\/https:\/\/x.com\/vinish_kapoor"]}]}},"_links":{"self":[{"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/posts\/4361","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/comments?post=4361"}],"version-history":[{"count":2,"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/posts\/4361\/revisions"}],"predecessor-version":[{"id":17723,"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/posts\/4361\/revisions\/17723"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/media\/16142"}],"wp:attachment":[{"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/media?parent=4361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/categories?post=4361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vinish.dev\/wp-json\/wp\/v2\/tags?post=4361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}