【问题标题】:How to send email from Oracle Apex using MailGun如何使用 MailGun 从 Oracle Apex 发送电子邮件
【发布时间】:2019-10-10 19:02:15
【问题描述】:

什么:

  1. 您使用mailgun.com 成功创建了您的 smtp 服务器

  2. 您想在 Oracle Apex(4.x 及更高版本)中配置您的 MailGun SMTP 服务器?

【问题讨论】:

    标签: oracle smtp oracle-apex mailgun


    【解决方案1】:

    如何

       SMTP Host Address : smtp.mailgun.org [ MUST use this one and NOT yours ] 
       SMTP Host Port : 587
       Use SSL/TLS : No [ important ]
       SMTP Authentication Username   : postmaster@yourdomain.com
       SMTP Authentication Password   : 2118870544b548867c2258f318fba6dd-9949a98f-201cc5b5 [ see in image below ] 
       Default Email From Address     : etay@yourdomain.com
    

    • 要应用的数据库 ACL 设置(您可以使用下面的代码 - credits
    -- to be run as user SYS
    
    -- to avoid ORA-30992 and ORA-01858 due to invalid date format when calling create_acl
    alter session set nls_language = AMERICAN;
    alter session set nls_territory = AMERICA;
    
    BEGIN
      DBMS_NETWORK_ACL_ADMIN.create_acl (
        acl          => 'apex.xml', 
        description  => 'Access Control List for APEX',
        principal    => 'APEX_050000',
        is_grant     => TRUE, 
        privilege    => 'connect',
        start_date   => SYSTIMESTAMP,
        end_date     => NULL);
      COMMIT;
    END;
    /
    
    -- for outgoing mail via local mail server
    
    BEGIN
      DBMS_NETWORK_ACL_ADMIN.assign_acl (
        acl         => 'apex.xml',
        host        => 'localhost', 
        lower_port  => 25,
        upper_port  => 25); 
      COMMIT;
    END;
    /
    
    -- for integration to PayPal (also requires Oracle Wallet with SSL certificate)
    
    BEGIN
      DBMS_NETWORK_ACL_ADMIN.assign_acl (
        acl         => 'apex.xml',
        host        => '*.paypal.com', 
        lower_port  => 443,
        upper_port  => 443); 
      COMMIT;
    END;
    /
    
    -- for integration with Amazon S3 (use port 443 if using SSL)
    
    BEGIN
      DBMS_NETWORK_ACL_ADMIN.assign_acl (
        acl         => 'apex.xml',
        host        => '*.amazonaws.com', 
        lower_port  => 80,
        upper_port  => 80); 
      COMMIT;
    END;
    /
    
    /*
    
    -- add another user/schema to already existing ACL
    
    BEGIN
      DBMS_NETWORK_ACL_ADMIN.add_privilege ( 
        acl         => 'apex.xml', 
        principal   => 'YOUR_SCHEMA_NAME',
        is_grant    => TRUE, 
        privilege   => 'connect', 
        position    => NULL, 
        start_date  => NULL,
        end_date    => NULL);
    
      COMMIT;
    END;
    /
    
    */
    
    
    -- to verify settings:
    select host, lower_port, upper_port, acl
    from dba_network_acls;
    
    select *
    from dba_network_acl_privileges;
    
    • 测试一下:
    apex_mail.send(
            p_to       => 'MyGmailAccount@gmail.com' ,   -- change to your email address
            p_from     => 'etay@yourdomain.com', -- change to a real senders email address
            p_body     => 'test',
            p_body_html => '<html><body>test</body></html>',
            p_subj     => 'test mailgun');
    

    【讨论】:

      猜你喜欢
      • 2018-07-01
      • 1970-01-01
      • 2022-01-17
      • 2019-01-31
      • 2016-08-14
      • 2017-10-12
      • 2021-01-01
      • 1970-01-01
      • 2016-01-24
      相关资源
      最近更新 更多