Edit D:\app\Administrator\product\11.2.0\dbhome_1\apex\images\doc\AEAPI\apex_mail003.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <title>SEND Procedure</title> <meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1" /> <meta name="date" content="2009-04-14T17:32:16Z" /> <meta name="robots" content="noarchive" /> <meta name="doctitle" content="SEND Procedure" /> <meta name="relnum" content="Release 3.2" /> <meta name="partnum" content="E12510-01" /> <link rel="copyright" href="../dcommon/html/cpyr.htm" title="Copyright" type="text/html" /> <link rel="stylesheet" href="../dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" /> <link rel="contents" href="toc.htm" title="Contents" type="text/html" /> <link rel="up" href="preface" title="Home" type="text/html" /> <link rel="up" href="apex_mail.htm" title="APEX_MAIL" type="text/html" /> <link rel="up" href="apex_mail003.htm" title="SEND Procedure" type="text/html" /> <link rel="prev" href="apex_mail002.htm" title="Previous" type="text/html" /> <link rel="next" href="apex_item.htm" title="Next" type="text/html" /> </head> <body> <p id="BREADCRUMBING"><a href="preface" title="Home">Home</a> > <a href="apex_mail.htm" title="APEX_MAIL">APEX_MAIL</a> > SEND Procedure</p> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> <col width="86%" /> <col width="*" /> <tr valign="bottom"> <td align="left"></td> <td align="center"><a href="apex_mail002.htm"><img src="../dcommon/gifs/leftnav.gif" alt="Previous" /><br /> <span class="icon">Previous</span></a> </td> <td align="center"><a href="apex_item.htm"><img src="../dcommon/gifs/rightnav.gif" alt="Next" /><br /> <span class="icon">Next</span></a></td> </tr> </table> <p><a id="CHDDAAJE" name="CHDDAAJE"></a></p> <hr /> <div class="refsect1"> <h1><a name="AEAPI342" id="AEAPI342"></a>SEND <a id="sthref509" name="sthref509"></a><a id="sthref510" name="sthref510"></a><a id="sthref511" name="sthref511"></a>Procedure</h1> <p>This procedure sends an outbound email message from an application. Although you can use this procedure to pass in either a <code>VARCHAR2</code> or a <code>CLOB</code> to <code>p_body</code> and <code>p_body_html</code>, the data types must be the same. In other words, you cannot pass a <code>CLOB</code> to <code>P_BODY</code> and a <code>VARCHAR2</code> to <code>p_body_html</code>.</p> <p>When using <code>APEX_MAIL.SEND</code>, remember the following:</p> <ul> <li> <p><span class="bold">No single line may exceed 1000 characters.</span> The SMTP/MIME specification dictates that no single line shall exceed 1000 characters. To comply with this restriction, you must add a carriage return or line feed characters to break up your <code>p_body</code> or <code>p_body_html</code> parameters into chunks of 1000 characters or less. Failing to do so will result in erroneous email messages, including partial messages or messages with extraneous exclamation points.</p> </li> <li> <p><span class="bold">Plain text and HTML email content.</span> Passing a value to <code>p_body,</code> but not <code>p_body_html</code> results in a plain text message. Passing a value to <code>p_body</code> and <code>p_body_html</code> yields a multi-part message that includes both plain text and HTML content. The settings and capabilities of the recipient's email client determine what displays. Although most modern email clients can read an HTML formatted email, remember that some users disable this functionality to address security issues.</p> </li> <li> <p><span class="bold">Avoid images.</span> When referencing images in <code>p_body_html</code> using the <code><img /></code> tag, remember that the images must be accessible to the recipient's email client in order for them to see the image.</p> <p>For example, suppose you reference an image on your network called <code>hello.gif</code> as follows:</p> <pre xml:space="preserve" class="oac_no_warn"> <img src="http://someserver.com/hello.gif" alt="Hello" />] </pre> <p>In this example, the image is not attached to the email, but is referenced by the email. For the recipient to see it, they must be able to access the image using a Web browser. If the image is inside a firewall and the recipient is outside of the firewall, the image will not display. For this reason, avoid using images. If you must include images, be sure to include the ALT attribute to provide a textual description in the event the image is not accessible.</p> </li> </ul> <a id="sthref512" name="sthref512"></a> <p class="subhead2">Syntax</p> <pre xml:space="preserve" class="oac_no_warn"> APEX_MAIL.SEND( p_to IN VARCHAR2, p_from IN VARCHAR2, p_body IN [ VARCHAR2 | CLOB ], p_body_html IN [ VARCHAR2 | CLOB ] DEFAULT NULL, p_subj IN VARCHAR2 DEFAULT NULL, p_cc IN VARCHAR2 DEFAULT NULL, p_bcc IN VARCHAR2 DEFAULT NULL, p_replyto IN VARCHAR2); </pre> <a id="sthref513" name="sthref513"></a> <p class="subhead2">Parameters</p> <p><a href="#CHDIIAFI">Table: SEND Parameters</a> describes the parameters available in the <code>SEND</code> procedure.</p> <div class="tblformal"><a id="sthref514" name="sthref514"></a><a id="CHDIIAFI" name="CHDIIAFI"></a> <p class="titleintable">SEND Parameters</p> <table class="Formal" title="SEND Parameters" summary="This table describes the parameters available in SEND." dir="ltr" border="1" width="100%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0"> <col width="31%" /> <col width="*" /> <thead> <tr align="left" valign="top"> <th align="left" valign="bottom" id="r1c1-t10">Parameter</th> <th align="left" valign="bottom" id="r1c2-t10">Description</th> </tr> </thead> <tbody> <tr align="left" valign="top"> <td align="left" id="r2c1-t10" headers="r1c1-t10"> <p><code>p_to</code></p> </td> <td align="left" headers="r2c1-t10 r1c2-t10"> <p>Valid email address to which the email will be sent (required). For multiple email addresses, use a comma-separated list</p> </td> </tr> <tr align="left" valign="top"> <td align="left" id="r3c1-t10" headers="r1c1-t10"> <p><code>p_from</code></p> </td> <td align="left" headers="r3c1-t10 r1c2-t10"> <p>Email address from which the email will be sent (required). This email address must be a valid address. Otherwise, the message will not be sent</p> </td> </tr> <tr align="left" valign="top"> <td align="left" id="r4c1-t10" headers="r1c1-t10"> <p><code>p_body</code></p> </td> <td align="left" headers="r4c1-t10 r1c2-t10"> <p>Body of the email in plain text, not HTML (required). If a value is passed to <code>p_body_html</code>, then this is the only text the recipient sees. If a value is not passed to <code>p_body_html</code>, then this text only displays for email clients that do not support HTML or have HTML disabled. A carriage return or line feed (CRLF) must be included every 1000 characters.</p> </td> </tr> <tr align="left" valign="top"> <td align="left" id="r5c1-t10" headers="r1c1-t10"> <p><code>p_body_html</code></p> </td> <td align="left" headers="r5c1-t10 r1c2-t10"> <p>Body of the email in HTML format. This must be a full HTML document including the <code><html></code> and <code><body></code> tags. A single line cannot exceed 1000 characters without a carriage return or line feed (CRLF)</p> </td> </tr> <tr align="left" valign="top"> <td align="left" id="r6c1-t10" headers="r1c1-t10"> <p><code>p_subj</code></p> </td> <td align="left" headers="r6c1-t10 r1c2-t10"> <p>Subject of the email</p> </td> </tr> <tr align="left" valign="top"> <td align="left" id="r7c1-t10" headers="r1c1-t10"> <p><code>p_cc</code></p> </td> <td align="left" headers="r7c1-t10 r1c2-t10"> <p>Valid email addresses to which the email is copied. For multiple email addresses, use a comma-separated list</p> </td> </tr> <tr align="left" valign="top"> <td align="left" id="r8c1-t10" headers="r1c1-t10"> <p><code>p_bcc</code></p> </td> <td align="left" headers="r8c1-t10 r1c2-t10"> <p>Valid email addresses to which the email is blind copied. For multiple email addresses, use a comma-separated list</p> </td> </tr> <tr align="left" valign="top"> <td align="left" id="r9c1-t10" headers="r1c1-t10"> <p><code>p_replyto</code></p> </td> <td align="left" headers="r9c1-t10 r1c2-t10"> <p>Address of the Reply-To mail header. You can use this parameter as follows:</p> <ul> <li> <p>If you omit the <code>p_replyto</code> parameter, the Reply-To mail header is set to the value specified in the <code>p_from</code> parameter</p> </li> <li> <p>If you include the <code>p_replyto</code> parameter, but provide a <code>NULL</code> value, the Reply-To mail header is set to NULL. This results in the suppression of automatic email replies</p> </li> <li> <p>If you include <code>p_replyto</code> parameter, but provide a non-null value (for example, a valid email address), you will send these messages, but the automatic replies will go to the value specified (for example, the email address)</p> </li> </ul> </td> </tr> </tbody> </table> <br /></div> <!-- class="tblformal" --> <a id="sthref515" name="sthref515"></a> <p class="subhead2">Examples</p> <p>The following example demonstrates how to use <code>APEX_MAIL.SEND</code> to send a plain text email message from an application.</p> <pre xml:space="preserve" class="oac_no_warn"> -- Example One: Plain Text only message DECLARE l_body CLOB; BEGIN l_body := 'Thank you for your interest in the APEX_MAIL package.'||utl_tcp.crlf||utl_tcp.crlf; l_body := l_body ||' Sincerely,'||utl_tcp.crlf; l_body := l_body ||' The APEX Dev Team'||utl_tcp.crlf; apex_mail.send( p_to => 'some_user@somewhere.com', -- change to your email address p_from => 'some_sender@somewhere.com', -- change to a real senders email address p_body => l_body, p_subj => 'APEX_MAIL Package - Plain Text message'); END; / </pre> <p>The following example demonstrates how to use <code>APEX_MAIL.SEND</code> to send an HTML email message from an application. Remember, you must include a carriage return or line feed (CRLF) every 1000 characters. The example that follows uses <code>utl_tcp.crlf</code>.</p> <pre xml:space="preserve" class="oac_no_warn"> -- Example Two: Plain Text / HTML message DECLARE l_body CLOB; l_body_html CLOB; BEGIN l_body := 'To view the content of this message, please use an HTML enabled mail client.'||utl_tcp.crlf; l_body_html := '<html> <head> <style type="text/css"> body{font-family: Arial, Helvetica, sans-serif; font-size:10pt; margin:30px; background-color:#ffffff;} span.sig{font-style:italic; font-weight:bold; color:#811919;} </style> </head> <body>'||utl_tcp.crlf; l_body_html := l_body_html ||'<p>Thank you for your interest in the <strong>APEX_MAIL</strong> package.</p>'||utl_tcp.crlf; l_body_html := l_body_html ||' Sincerely,<br />'||utl_tcp.crlf; l_body_html := l_body_html ||' <span class="sig">The APEX Dev Team</span><br />'||utl_tcp.crlf; apex_mail.send( p_to => 'some_user@somewhere.com', -- change to your email address p_from => 'some_sender@somewhere.com', -- change to a real senders email address p_body => l_body, p_body_html => l_body_html, p_subj => 'APEX_MAIL Package - HTML formatted message'); END; / </pre></div> <!-- class="refsect1" --> <!-- Start Footer --> <div class="footer"> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> <col width="86%" /> <col width="*" /> <tr> <td align="left"><span class="copyrightlogo">Copyright © 2003, 2009, Oracle and/or its affiliates. All rights reserved.</span><br /> <a href="../dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td> <td align="center"><a href="apex_mail002.htm"><img src="../dcommon/gifs/leftnav.gif" alt="Previous" /><br /> <span class="icon">Previous</span></a> </td> <td align="center"><a href="apex_item.htm"><img src="../dcommon/gifs/rightnav.gif" alt="Next" /><br /> <span class="icon">Next</span></a></td> </tr> </table> </div> <!-- class="footer" --> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de