{"id":1865,"date":"2011-04-17T15:12:26","date_gmt":"2011-04-17T09:42:26","guid":{"rendered":"http:\/\/sendyoursmiles.com\/?p=1865"},"modified":"2011-04-17T15:12:26","modified_gmt":"2011-04-17T09:42:26","slug":"send-e-mail-through-pl-sql-code-utl-smtp-mail","status":"publish","type":"post","link":"https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail","title":{"rendered":"Send e mail through PL SQL code (UTL_SMTP, UTL_MAIL)"},"content":{"rendered":"<p>utl_smtp example: <\/p>\n<p><code><br \/>\nCREATE OR REPLACE PROCEDURE erpschools_send_email<br \/>\nIS<br \/>\nmailhost varchar2 (30) := 'smtp.erpschools.com';<br \/>\ncrlf varchar2(2)\u00c2 := CHR (13) || CHR (10);<br \/>\nv_email varchar2(16000);<br \/>\nmessage_1 LONG;<br \/>\nmail_conn utl_smtp.connection;<br \/>\nBEGIN<br \/>\nmail_conn := utl_smtp.open_connection (mailhost, 25);<br \/>\nutl_smtp.helo (mail_conn, mailhost);<br \/>\nutl_smtp.mail (mail_conn, 'sender@erpschools.com');<br \/>\nutl_smtp.rcpt (mail_conn, 'receiver@erpschools.com');<br \/>\nmessage_1 := 'From: Mr Sender < sender@erpschools.com >' || crlf ||<br \/>\n'Subject: Testing Hyperlink' || crlf ||<br \/>\n'To: Mrs Receiver <Receiver@erpschools.com>' || crlf ||<br \/>\n'<a href=\"http:\/\/www.erpschools.com\" target=\"new\" www.erpschools.com<\/a>' || crlf || crlf ;<br \/>\nutl_smtp.data(mail_conn, 'MIME-Version: 1.0' ||CHR(13)||CHR(10)||'Content-type: text\/html' || CHR(13)||CHR(10)||message_1);<br \/>\nutl_smtp.quit (mail_conn);<br \/>\nEND;<br \/>\n<\/code><\/p>\n<p>UTL_MAIL: This is the new package introduced in 10g. even though this uses the UTL_SMTP in the background the advantage with this script is we can change the mail server and ports in the configuration file with out changing the code. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>utl_smtp example: CREATE OR REPLACE PROCEDURE erpschools_send_email IS mailhost varchar2 (30) := &#8216;smtp.erpschools.com&#8217;; crlf varchar2(2)\u00c2 := CHR (13) || CHR (10); v_email varchar2(16000); message_1 LONG; mail_conn utl_smtp.connection; BEGIN mail_conn := utl_smtp.open_connection (mailhost, 25); utl_smtp.helo (mail_conn, mailhost); utl_smtp.mail (mail_conn, &#8216;sender@erpschools.com&#8217;); utl_smtp.rcpt (mail_conn, &#8216;receiver@erpschools.com&#8217;); message_1 := &#8216;From: Mr Sender < sender@erpschools.com >&#8216; || crlf || &#8216;Subject: Testing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[9,91],"class_list":["post-1865","post","type-post","status-publish","format-standard","hentry","category-scripts","tag-utl_mail","tag-utl_smtp"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>utl_smtp example<\/title>\n<meta name=\"description\" content=\"Oracle Scripts to send email using utl_smtp example, alternatively UTL_MAIL can be used in latest versions of oracle database.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prudhvi\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail#article\",\"isPartOf\":{\"@id\":\"https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail\"},\"author\":{\"name\":\"Prudhvi\",\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/person\/dbed9bb7fb66aa7a700fc565da024512\"},\"headline\":\"Send e mail through PL SQL code (UTL_SMTP, UTL_MAIL)\",\"datePublished\":\"2011-04-17T09:42:26+00:00\",\"dateModified\":\"2011-04-17T09:42:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail\"},\"wordCount\":57,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\/\/erpschools.com\/erps\/#organization\"},\"keywords\":[\"UTL_MAIL\",\"UTL_SMTP\"],\"articleSection\":[\"Scripts\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail\",\"url\":\"https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail\",\"name\":\"utl_smtp example\",\"isPartOf\":{\"@id\":\"https:\/\/erpschools.com\/erps\/#website\"},\"datePublished\":\"2011-04-17T09:42:26+00:00\",\"dateModified\":\"2011-04-17T09:42:26+00:00\",\"description\":\"Oracle Scripts to send email using utl_smtp example, alternatively UTL_MAIL can be used in latest versions of oracle database.\",\"breadcrumb\":{\"@id\":\"https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/erpschools.com\/erps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Send e mail through PL SQL code (UTL_SMTP, UTL_MAIL)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/erpschools.com\/erps\/#website\",\"url\":\"https:\/\/erpschools.com\/erps\/\",\"name\":\"erpSchools\",\"description\":\"Oracle Apps\",\"publisher\":{\"@id\":\"https:\/\/erpschools.com\/erps\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/erpschools.com\/erps\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/erpschools.com\/erps\/#organization\",\"name\":\"erpSchools\",\"url\":\"https:\/\/erpschools.com\/erps\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/erpschools.com\/erps\/wp-content\/uploads\/img\/erps_logo7.png\",\"contentUrl\":\"https:\/\/erpschools.com\/erps\/wp-content\/uploads\/img\/erps_logo7.png\",\"width\":250,\"height\":60,\"caption\":\"erpSchools\"},\"image\":{\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"http:\/\/facebook.com\/erpschools\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/person\/dbed9bb7fb66aa7a700fc565da024512\",\"name\":\"Prudhvi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/488cec3605845b95cb20e60c67a8f5c7e74b65a305525c8006315d524f120db9?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/488cec3605845b95cb20e60c67a8f5c7e74b65a305525c8006315d524f120db9?s=96&d=blank&r=g\",\"caption\":\"Prudhvi\"},\"sameAs\":[\"http:\/\/www.erpschools.com\"],\"url\":\"https:\/\/erpschools.com\/erps\/author\/prudhvi\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"utl_smtp example","description":"Oracle Scripts to send email using utl_smtp example, alternatively UTL_MAIL can be used in latest versions of oracle database.","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:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail","twitter_misc":{"Written by":"Prudhvi"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail#article","isPartOf":{"@id":"https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail"},"author":{"name":"Prudhvi","@id":"https:\/\/erpschools.com\/erps\/#\/schema\/person\/dbed9bb7fb66aa7a700fc565da024512"},"headline":"Send e mail through PL SQL code (UTL_SMTP, UTL_MAIL)","datePublished":"2011-04-17T09:42:26+00:00","dateModified":"2011-04-17T09:42:26+00:00","mainEntityOfPage":{"@id":"https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail"},"wordCount":57,"commentCount":3,"publisher":{"@id":"https:\/\/erpschools.com\/erps\/#organization"},"keywords":["UTL_MAIL","UTL_SMTP"],"articleSection":["Scripts"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail#respond"]}]},{"@type":"WebPage","@id":"https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail","url":"https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail","name":"utl_smtp example","isPartOf":{"@id":"https:\/\/erpschools.com\/erps\/#website"},"datePublished":"2011-04-17T09:42:26+00:00","dateModified":"2011-04-17T09:42:26+00:00","description":"Oracle Scripts to send email using utl_smtp example, alternatively UTL_MAIL can be used in latest versions of oracle database.","breadcrumb":{"@id":"https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/erpschools.com\/erps\/scripts\/send-e-mail-through-pl-sql-code-utl-smtp-mail#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/erpschools.com\/erps"},{"@type":"ListItem","position":2,"name":"Send e mail through PL SQL code (UTL_SMTP, UTL_MAIL)"}]},{"@type":"WebSite","@id":"https:\/\/erpschools.com\/erps\/#website","url":"https:\/\/erpschools.com\/erps\/","name":"erpSchools","description":"Oracle Apps","publisher":{"@id":"https:\/\/erpschools.com\/erps\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/erpschools.com\/erps\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/erpschools.com\/erps\/#organization","name":"erpSchools","url":"https:\/\/erpschools.com\/erps\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/erpschools.com\/erps\/#\/schema\/logo\/image\/","url":"https:\/\/erpschools.com\/erps\/wp-content\/uploads\/img\/erps_logo7.png","contentUrl":"https:\/\/erpschools.com\/erps\/wp-content\/uploads\/img\/erps_logo7.png","width":250,"height":60,"caption":"erpSchools"},"image":{"@id":"https:\/\/erpschools.com\/erps\/#\/schema\/logo\/image\/"},"sameAs":["http:\/\/facebook.com\/erpschools"]},{"@type":"Person","@id":"https:\/\/erpschools.com\/erps\/#\/schema\/person\/dbed9bb7fb66aa7a700fc565da024512","name":"Prudhvi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/erpschools.com\/erps\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/488cec3605845b95cb20e60c67a8f5c7e74b65a305525c8006315d524f120db9?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/488cec3605845b95cb20e60c67a8f5c7e74b65a305525c8006315d524f120db9?s=96&d=blank&r=g","caption":"Prudhvi"},"sameAs":["http:\/\/www.erpschools.com"],"url":"https:\/\/erpschools.com\/erps\/author\/prudhvi"}]}},"_links":{"self":[{"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/posts\/1865","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/comments?post=1865"}],"version-history":[{"count":0,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/posts\/1865\/revisions"}],"wp:attachment":[{"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/media?parent=1865"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/categories?post=1865"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/tags?post=1865"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}