zoukankan      html  css  js  c++  java
  • Oracle 10g: UTL_MAIL

    UTL_MAIL

    The UTL_MAIL package provides a simple API to allow email to be sent from PL/SQL. In prior versions this was possible using the UTL_SMTP package (shown here), but this required knowledge of the SMTP protocol.

    The package is loaded by running the following scripts.

    CONN sys/password AS SYSDBA
    @$ORACLE_HOME/rdbms/admin/utlmail.sql
    @$ORACLE_HOME/rdbms/admin/prvtmail.plb

    In addition the SMTP_OUT_SERVER parameter must be set to identify the SMTP server.

    CONN sys/password AS SYSDBA
    ALTER SYSTEM SET smtp_out_server='smtp.domain.com' SCOPE=SPFILE;
    SHUTDOWN IMMEDIATE
    STARTUP

    With the configuration complete we can now send a mail.

    BEGIN
      UTL_MAIL.send(sender     => 'me@domain.com',
                    recipients => 'person1@domain.com,person2@domain.com',
                    cc         => 'person3@domain.com',
                    bcc        => 'myboss@domain.com',
                    subject    => 'UTL_MAIL Test',
                    message    => 'If you get this message it worked!');
    END;
    /

    The package also supports sending mails with RAW and VARCHAR2 attachments.

  • 相关阅读:
    初学移动专题
    IE下a标签跳转失败
    c++中一个多态的实例
    字符串中是否有相同的字符
    求乘积最大的连续子序列
    跳跃游戏
    求一个非负整数的平方根 二分法
    罗马数 与 整数 相互转换
    二进制相加
    链表分割
  • 原文地址:https://www.cnblogs.com/tracy/p/2089187.html
Copyright © 2011-2022 走看看