GVKun编程网logo

Oracle Apps DBA 常用命令(oracle dba_users)

1

本文的目的是介绍OracleAppsDBA常用命令的详细情况,特别关注oracledba_users的相关信息。我们将通过专业的研究、有关数据的分析等多种方式,为您呈现一个全面的了解OracleApp

本文的目的是介绍Oracle Apps DBA 常用命令的详细情况,特别关注oracle dba_users的相关信息。我们将通过专业的研究、有关数据的分析等多种方式,为您呈现一个全面的了解Oracle Apps DBA 常用命令的机会,同时也不会遗漏关于89745928/apps: lstat /var/lib/docker/tmp/buildkit-mount589745928/apps: 没有这样的文件或目录、Apps Script Web Apps 是否受定价和配额限制?、Apps Script WebApp - 从谷歌工作表中的数据更新文本框字段 Google Apps 脚本方面:Javascript 端:、Apps 脚本 - 将附件添加到电子邮件确认 如何使用 Apps 脚本通过电子邮件从云端硬盘发送附件编辑参考资料的知识。

本文目录一览:

Oracle Apps DBA 常用命令(oracle dba_users)

Oracle Apps DBA 常用命令(oracle dba_users)

数据库启动监听 addlnctl.sh start instance 启动数据库 addbctl.sh start 启动应用服务器 adstrtal.sh 停止应用服务器 adstpall.sh ------------------------------- 系统启动/关闭相关的脚本 数据库层 名称: addbctl.sh 说明: Start/Stop database 路径: $

数据库启动监听

addlnctl.sh start instance


启动数据库

addbctl.sh start

启动应用服务器
adstrtal.sh


停止应用服务器
adstpall.sh


-------------------------------

系统启动/关闭相关的脚本

  • 数据库层
  • 名称: addbctl.sh
    说明: Start/Stop database
    路径: ${ORACLE_HOME}/appsutil/scripts/VIS_ebs121/addbctl.sh
  • 应用层
  • 名称: adalnctl.sh
    说明: Start / Stop Applications RPC Listener process
    路径: ${INST_TOP}/admin/scripts/adalnctl.sh

    名称: adapcctl.sh
    说明: start, stop and check the status of Oracle HTTP Server.
    路径: ${INST_TOP}/admin/scripts/adapcctl.sh

    名称: adoacorectl.sh
    说明: start, stop and check the status of the oacore oc4j instance
    路径: ${INST_TOP}/admin/scripts/adoacorectl.sh

    名称: adformsctl.sh
    说明: start, stop and check the status of the forms oc4j instance.
    路径: ${INST_TOP}/admin/scripts/adformsctl.sh

    名称: adcmctl.sh
    说明: Start / Stop Concurrent Manager for VIS
    路径: ${INST_TOP}/admin/scripts/adcmctl.sh
  • AllInOne
  • 名称: adstrtal.sh
    说明: start Oracle E-Business Suite Services
    路径: ${INST_TOP}/admin/scripts/adstrtal.sh

    名称: adstpall.sh
    说明: stop Oracle E-Business Suite Services
    路径: ${INST_TOP}/admin/scripts/adstpall.sh

    可以讲这些脚本整合到root用户下, 实现EBS服务的启动与关闭. 以笔者为例:

    /root/scripts/start.shsu - oracle -c "${ORACLE_HOME}/appsutil/scripts/VIS_ebs121/addbctl.sh start"su - oracle -c "${ORACLE_HOME}/bin/lsnrctl start"su - applmgr -c "/d01/oracle/VIS/inst/apps/VIS_ebs121/admin/scripts/adalnctl.sh start"su - applmgr -c "/d01/oracle/VIS/inst/apps/VIS_ebs121/admin/scripts/adapcctl.sh start"su - applmgr -c "/d01/oracle/VIS/inst/apps/VIS_ebs121/admin/scripts/adoacorectl.sh start"su - applmgr -c "/d01/oracle/VIS/inst/apps/VIS_ebs121/admin/scripts/adformsctl.sh start"su - applmgr -c "/d01/oracle/VIS/inst/apps/VIS_ebs121/admin/scripts/adcmctl.sh start apps/apps"
    /root/scripts/stop.sh
    su - applmgr -c "/d01/oracle/VIS/inst/apps/VIS_ebs121/admin/scripts/adcmctl.sh stop apps/apps"
    su - applmgr -c "/d01/oracle/VIS/inst/apps/VIS_ebs121/admin/scripts/adformsctl.sh stop"
    su - applmgr -c "/d01/oracle/VIS/inst/apps/VIS_ebs121/admin/scripts/adoacorectl.sh stop"
    su - applmgr -c "/d01/oracle/VIS/inst/apps/VIS_ebs121/admin/scripts/adapcctl.sh stop"
    su - applmgr -c "/d01/oracle/VIS/inst/apps/VIS_ebs121/admin/scripts/adalnctl.sh stop"

    su - oracle -c "${ORACLE_HOME}/appsutil/scripts/VIS_ebs121/addbctl.sh stop immediate"

    以上就是一些与EBS启动/关闭相关的脚本介绍, 最后如果不希望打开VBox的窗体而通过ssh进行操作的

-------------------------------

查看HTTP/OC4J Status

adopmnctl.sh status

sample output:

Processes in Instance: mc3yd213_bej301441.bej301441.cn.oracle.com
---------------------------------+--------------------+---------+---------
ias-component                    | process-type       |     pid | status
---------------------------------+--------------------+---------+---------
OC4JGroup:default_group          | OC4J:oafm          |   16924 | Alive
OC4JGroup:default_group          | OC4J:forms         |   16851 | Alive
OC4JGroup:default_group          | OC4J:oacore        |   16767 | Alive
HTTP_Server                      | HTTP_Server        |   16710 | Alive


==================================================

Order of Startup Shutdown
————————————–

As in Oracle Apps 11i order for startup is
A) Start Database Tier Services
–Start Database Listener
–Start Database
Then
B) Start Application/Middle Tier Services
– adstrtal.sh

Order for shutdown in Oracle Apps R12 is
A) Stop Application/Middle Tier Services
– adstpall.sh
Then
B) Stop Database Tier Services
–Stop Database
–Stop Database Listener

Database Tier Scripts in R12
————————————–

For Database tier you need to start database and database listener. Scripts are located inDatabase_Install_Dir/db/tech_st/10.2.0/appsutil/scripts/$CONTEXT_NAME- For Database
Use script addbctl.sh

- For Database Listener
Use script addlnctl.sh

or alternatively you can use
lsnrctl startstop listener_name (For Database Listener)
sqlplus “/as sysdba”
SQL> startup shutdownimmediate

Middle/Application Tier Scripts in R12
————————————————-

Scripts for Application Tier services in R12 are located in “Install_base/inst/apps/$CONTEXT_NAME/admin/scripts
where CONTEXT_NAME is of format SID_HOSTNAME

i) adstrtal.sh
Master script to start all components/services of middle tier or application tier. This script will use Service ControlAPI to start all services which are enabled after checking them in context file (SID_HOSTNAME.xml or CONTEXT_NAME.xml)

ii) adstpall.sh
Master script to stop all components/services of middle tier or application tier.

iii) adalnctl.sh
Script to start / stop apps listener (FNDFS andFNDFS). This listener will file will be in 10.1.2 ORACLE_HOME (i.e. Forms & Reports Home)
listener.ora file will be in $INST_TOP/apps/$CONTEXT_NAME/ora/10.1.2/network/admin directory
(Mostly similar to one in 11i with only change in ORACLE_HOME i.e. from 8.0.6 to 10.1.2)

iv) adapcctl.sh
Script to start/stop Web Server or Oracle HTTP Server. This script uses opmn (Oracle Process Manager and Notification Server) with syntax similar toopmnctl [startstop]proc ohs
like opmnctlstopproc ohs.

(In 11i this script directly used to callapachectl executable but now callsopmnctl whichin turn calls apachectl. In 11i web server oracle home was 1.0.2.2.2 but in R12 its 10.1.3)

v) adcmctl.sh
Script to start / stop concurrent manager, Similar to one in 11i. (This script in turn calls startmgr.sh )

vi) adformsctl.sh
Script to start / stop Forms OC4J from 10.1.3 Oracle_Home. This script will also use opmnctl to start/stop Forms OC4J like
opmnctl stopproc type=oc4jinstancename=forms

vii) adformsrvctl.sh
This script is used only if you wish to start forms in socket mode. Default forms connect method in R12 isservlet.
If started this will start frmsrv executable from 10.1.2 Oracle_Home in Apps R12

viii) adoacorectl.sh
This script will start/stop oacoreOC4J in 10.1.3 Oracle_Home. This scripts will also useopmnctl (similar toadapcctl &adformsctl) to startoacore instance ofOC4J like
opmnctlstartproc type=oc4jinstancename=oacore

ix) adoafmctl.sh
This script will start/stop oafmOC4J in 10.1.3 Oracle_Home. This scripts will also useopmnctl (similar to above) to startoacore instance ofOC4J like
opmnctlstartproc type=oc4jinstancename=oafm

x) adopmnctl.sh
This script will start/stop opmn service in 10.1.3 Oracle_Home. opmn will control all services in 10.1.3 Oracle_Home like web server or variousoc4j instances. If any services are stopped abnormallyopmn will/should start them automatically.

xi) jtffmctl.sh
This script will be used to start/stop one to one fulfilment server.

xii) mwactl.sh
To start / stop mwa telnet server wheremwa is mobile application.

Log File Location for Startup Shutdown Services in R12
———————————————————————-

Log files for startup/shutdown scripts for application/mid tier in R12 are in$INST_TOP/apps/$CONTEXT_NAME/logs/appl/admin/log
(adalnctl.txt,adapcctl.txt,adcmctl.txt,adformsctl.txt,adoacorectl.txt,adoafmctl.txt,adopmnctl.txt,adstrtal.log,jtffmctl.txt )

==================================================


RDBMS ORACLE_HOME Control scripts
(located under /appsutil/scripts/)

Control Script

Functionality

addbctl.sh Control database server
addlnctl.sh Control Oracle Net listener for the database server


RDBMS ORACLE_HOME Install scripts

(located under /appsutil/install/)

Install Script

Functionality

adsvdlsn.sh Start Oracle Net listener during installation
adcrdb.sh Start database and create database control files
addbprf.sh Set profile option values
adsvdcnv.sh Perform character set conversion and licensing tasks
adsvdb.sh Start database during installation


Application Service Control scripts

(located under /admin/scripts)

Control Script

Functionality

Node

adalnctl.sh Control Oracle Net8 listener for Applications services All application tier server nodes
adstrtal.sh Start all Applications server processes All application tier server nodes
adstpall.sh Stop all Applications server processes All application tier server nodes
adcmctl.sh Control Concurrent managers Concurrent processing server node
adapcctl.sh Control Apache processes HTTP server node
adopmnctl.sh Controls Oracle Process Manager HTTP server node
adoacorectl.sh Controls Oacore Oc4j Instance HTTP server node
adformsctl.sh Controls Forms Oc4j Instance HTTP server node
adoafmctl.sh Controls Oafm Oc4j Instance HTTP server node
jtffmctl.sh Control Oracle fulfillment server HTTP server node

==================================================

Instance Home($INST_TOP) Directory Structure

Instance Home contains all the config files, log files, SSL certificates etc.

  • $INST_TOP/admin/scripts ($ADMIN_SCRIPTS_HOME): All AD scripts are located here
  • $INST_TOP/appl ($APPL_CONFIG_HOME) : For standalone envs, this is set to $APPL_TOP
        $INST_TOP/appl/fnd/12.0.0/secure FND_SECURE: The dbc file is located here
        $INST_TOP/appl/admin All the env config files are located here
  • $INST_TOP/certs SSL Certificates go here
  • $INST_TOP/logs LOG_HOME: Central log file location. All log files are placed here (except adconfig)
        $INST_TOP/logs/ora ($ORA_CONFIG_HOME)
        $INST_TOP/logs/ora/10.1.2 ‘C’ Oracle home config, Contains tnsnames and forms listener servlet config files
         $INST_TOP/logs/ora/10.1.3 Apache & OC4J config home, Apache, OC4J and opmn. This is the ‘Java’ oracle home configuration for OPMN, Apache and OC4J
  • $INST_TOP/pids  Apache/Forms server PID files are located here
  • $INST_TOP/portal Apache’s DocumentRoot folder
  • ==================================================

    AD Command Line Utilities
    AD Utility Name Executable or Script Description
    AD Administration adadmin Performs maintenance tasks for Oracle E-Business Suite.
    AD Check Digest adchkdig Checks the integrity of Oracle E-Business Suite patches downloaded from My Oracle Support.
    AD Configuration adutconf.sql Reports standard information about the installed configuration of Oracle E-Business Suite.
    AD Controller adctrl Manages parallel workers in AD Administration and AutoPatch.
    AD File Identification adident Reports the version and translation level of an Oracle E-Business Suite file.
    AD File Character Set Converter adncnv Converts a file from one character set to another.
    AD Merge Patch* admrgpch Merges multiple patches into a single merged patch.
    AD Relink adrelink.sh Relinks Oracle E-Business Suite executable programs with the Oracle server product libraries.
    AD Splicer adsplice Adds off-cycle products.
    AD Job Timing Report Reports a summary of the timing for jobs run by parallel workers.
    AutoPatch* adpatch Applies patches and other system updates.
    Patch Application Assistant* admsi.pl Generates customized installation instructions for a patch.
    Rapid Install** rapidwiz Provides a wizard for entering parameters that are specific to a new installation or an upgrade of an Oracle E-Business Suite system.


    Reference:

    Oracle Applications(Apps) R12 (12.1.1) Installation on Linux

    http://www.freeoraclehelp.com/2011/11/oracle-applicationsapps-r12-1211.html

    R12 Instance Home Overview

    http://onlineappsdba.com/index.php/2007/10/19/r12-instance-home-overview/

    Start-up Shutdown Scripts in Oracle Apps R12

    http://onlineappsdba.com/index.php/2007/06/10/start-up-shutdown-scripts-in-oracle-apps-r12/

    Oracle E-Business Suite Maintenance Utilities

    http://docs.oracle.com/cd/E18727_01/doc.121/e13676/T530334T530337.htm

    EBS-r12.1.1安装
    http://ebshome.blogspot.jp/2012/06/ebs-r1211.html

    http://blog.csdn.net/pan_tian/article/details/7612517

    89745928/apps: lstat /var/lib/docker/tmp/buildkit-mount589745928/apps: 没有这样的文件或目录

    89745928/apps: lstat /var/lib/docker/tmp/buildkit-mount589745928/apps: 没有这样的文件或目录

    如何解决89745928/apps: lstat /var/lib/docker/tmp/buildkit-mount589745928/apps: 没有这样的文件或目录

    我想在运行 docker-compose build 时使用 docker an,但出现标题错误。我的问题是导致这个问题的原因是什么?

    这是 docker-compose.yml:

    1. version: ''3.8''
    2. services:
    3. Nginx:
    4. image: Nginx:1.19.0-alpine
    5. restart: on-failure
    6. volumes:
    7. - ''./apps/my-symfony-app/public:/usr/src/app''
    8. - ''./docker/Nginx/default.conf:/etc/Nginx/conf.d/default.conf:ro''
    9. ports:
    10. - ''80:80''
    11. depends_on:
    12. - PHP
    13. PHP:
    14. build:
    15. context: .
    16. dockerfile: .docker/PHP/Dockerfile
    17. volumes:
    18. - ''./apps/my-symfony-app/:/usr/src/app''
    19. restart: on-failure
    20. env_file:
    21. - .env
    22. user: 1000:1000

    我已经添加了这个 Dockerfile。也许这与这个文件有关,我不确定。

    1. FROM composer:2.0 as composer
    2. FROM PHP:7.4-fpm
    3. RUN docker-PHP-ext-install pdo_MysqL
    4. RUN pecl install apcu
    5. RUN apt-get update && \\
    6. apt-get install -y \\
    7. libzip-dev
    8. RUN docker-PHP-ext-install zip
    9. RUN docker-PHP-ext-enable apcu
    10. workdir /usr/src/app
    11. copY --chown=1000:1000 apps/my-symfony-app /usr/src/app
    12. RUN PATH=$PATH:/usr/src/app/vendor/bin:bin
    13. RUN composer install --no-scripts --prefer-dist \\
    14. && rm -rf "$(composer config cache-dir)" "$(composer config data-dir)"

    Apps Script Web Apps 是否受定价和配额限制?

    Apps Script Web Apps 是否受定价和配额限制?

    如何解决Apps Script Web Apps 是否受定价和配额限制?

    当您将 Google Sheets Apps 脚本部署为 Web 应用程序时,Google 对每个单位/请求收取多少费用,或者普通用户的免费配额是多少?

    Apps Script WebApp - 从谷歌工作表中的数据更新文本框字段 Google Apps 脚本方面:Javascript 端:

    Apps Script WebApp - 从谷歌工作表中的数据更新文本框字段 Google Apps 脚本方面:Javascript 端:

    如何解决Apps Script WebApp - 从谷歌工作表中的数据更新文本框字段 Google Apps 脚本方面:Javascript 端:

    我正忙于 Apps Script Web 应用程序,并且想使用来自 Google 表格的数据填充 Web 应用程序中的输入框。

    我正在尝试在单击按钮时检索数据,并使用从工作表中检索到的数据填充 web 应用程序中的字段。从 Google 表格中检索数据后,我似乎无法更新文本框字段。

    任何帮助将不胜感激。

    我到目前为止的代码是:

    Code.gs 文件

    function doGet() {
    
      var htmlOutput = HtmlService.createTemplateFromFile("page");
    
      return htmlOutput.evaluate();
    
    
    
    }
    
    function include(filename) {
      return HtmlService.createHtmlOutputFromFile(filename).getContent();
    }
    
    var idx;
    var nextLead;
    var totalLeads;
    var remainingLeads;
    
    function assignLead() {
      var ss = SpreadsheetApp.openById("sheetId");
      var ws = ss.getSheetByName("leads");
      var range = ws.getRange(1,1,ws.getLastRow(),ws.getLastColumn())
      var data = range.getValues();
    
      //console.log(data);
    
      var status = data.map(function (row) {
        return row[11];
      });
    
      //console.log(status);
      
      idx = status.indexOf("unassigned");
      //console.log(idx)
      for (var i = 0; i < data.length; i++) {
        nextLead = data[idx];
        updateStatusAssigned(idx)
      }
    
      // console.log(nextLead);
      // console.log(data);
    }
    
    function updateStatusAssigned(row) {
      var ss = SpreadsheetApp.openById("SheetId");
      var ws = ss.getSheetByName("leads");
      var range = ws.getRange(1,ws.getLastColumn())
      ws.getRange(idx + 1,12).setValue("assigned")
    }
    

    页面 html 文件

    <!DOCTYPE html>
    <html>
    
    <head>
        <base target="_top">
      <Meta name="viewport" content="width=device-width,initial-scale=1.0" />
    
      <?!= include("page-css") ?>
        
    </head>
    
    <body>
        <div>
    
            <!-- Header -->
            <div>
                <h1>Header</h1>
            </div>
    
            <!-- Agent Info -->
            <div>
                <div>
                    <p><label for="agnet">Agent Name:</label><input id="agent" type="text" ></input>
                    <label for="loginTime">Login Time:</label><input id="loginTime" type="text"></input></p>
                    <p><label for="campaign">Current Campaign:</label><input type="text" id="campaign"></input></p>
                    <button id="btn-getLead" style= float: right>Get Lead</button>
                </div>
                <!-- <div>
                    <button id="btn" style=”float: right”>Get Lead</button>
                </div> -->
            </div>
    
            <!-- Lead Details Banner -->
            <div>
                <div>
                    <h3>Lead Details</h3>
                </div>
    
                <!-- Customer information -->
                <div>
                    <div>
                        <p>
                            <h5>Customer information</h5>
                        </P>
                        <label>Name:</label><input type="text" id="name"></input>
                        <label>Surname:</label><input type="text" id="surname"></input>
                        <label>ID Number:</label><input type="text" id="id"></input>
                        <p><label>Address:</label><input type="text" id="add"></input><label>Postal Code:</label><input type="text" id="code"></input></p>
                        <p><label>Suburb:</label><input type="text" id="sub"></input></P>
                        <p><label>Postal Address:</label><input type="text" id="p-add"></input></p>
                        <p><label>Tel Number:</label><input type="tel" id="tel"></input>
                            <label>Mobile Number:</label><input type="tel" id="cell"></input>
                            <label>Alternate Number:</label><input type="tel" id="alt"></input></p>
                        <p>
                            <label>disposition</label>
                            <select id="dispo">
                <option> </option>   
                <option>Wrong Number</option>
                <option>No Answer</option>
                <option>Win</option>
                </select>
                        </p>
              <p>
                <button id="submit">Submit</button>
              </p>
                    </div>
    
                    <!-- Call Notes -->
                    <div>
                        <p>
                            <h5>Call Notes</h5>
                        </p>
                        <textarea rows="15" cols="50" id="notes"></textarea>
                    </div>
                </div>
    
          
      <?!= include("page-js") ?>
    </body>
    
    
    
    
    </html>
    

    page-js 文件

    <script>
      
    document.getElementById("btn-getLead").addEventListener("click",getLeadData);
    
    function getLeadData(){
      
      google.script.run.assignLead()
    
      document.getElementById("name") = nextLead[0]; 
    
    
    }
        
    </script>
    

    解决方法

    修改点:

    • 遗憾的是,在 Google Apps Script 端声明为全局的变量不能用于 Javascript 端。所以不能使用 nextLeaddocument.getElementById("name") = nextLead[0];
      • 我认为这是由于您的问题造成的。
    • 在这种情况下,可以使用 withSuccessHandler
    • 而且,我认为 document.getElementById("name") = nextLead[0]; 发生了错误。在这种情况下,请修改为 document.getElementById("name").value = nextLead[0];

    当以上几点反映到你的脚本中时,它变成如下。

    修改后的脚本:

    Google Apps 脚本方面:

    请修改assignLead()如下。

    从:
      for (var i = 0; i < data.length; i++) {
        nextLead = data[idx];
        updateStatusAssigned(idx)
      }
    
      // console.log(nextLead);
      // console.log(data);
    }
    
    到:
      for (var i = 0; i < data.length; i++) {
        nextLead = data[idx];
        updateStatusAssigned(idx)
      }
    
      // console.log(nextLead);
      // console.log(data);
      
      return nextLead; // Added
    }
    

    Javascript 端:

    从:
    function getLeadData(){
      
      google.script.run.assignLead()
    
      document.getElementById("name") = nextLead[0]; 
    
    
    }
    
    到:
    function getLeadData(){
      google.script.run.withSuccessHandler(nextLead => {
        document.getElementById("name").value = nextLead[0];
      }).assignLead();
    }
    

    注意:

    • 在这个修改后的脚本中,它假设您的 assignLead() 函数工作正常,而 nextLead 是您想要的正确值。请注意这一点。

    参考:

    • withSuccessHandler(function)

    Apps 脚本 - 将附件添加到电子邮件确认 如何使用 Apps 脚本通过电子邮件从云端硬盘发送附件编辑参考资料

    Apps 脚本 - 将附件添加到电子邮件确认 如何使用 Apps 脚本通过电子邮件从云端硬盘发送附件编辑参考资料

    如何解决Apps 脚本 - 将附件添加到电子邮件确认 如何使用 Apps 脚本通过电子邮件从云端硬盘发送附件编辑参考资料?

    使用此脚本,我将根据工作表中的某些字段发布两封不同的电子邮件(索引 1 或索引 2),但我需要从谷歌驱动器添加一个 .docx 文件作为已发布电子邮件的附件

    这是我到目前为止的脚本并且它正在工作我只需要从谷歌驱动器添加docx作为附件文件..请帮助

    //Pulling all data from spreadsheet variables
    var SpreadsheetID = "sheet id";
    var SheetName = "namesheet";
    var Now = new Date();
    var ss = SpreadsheetApp.openById(SpreadsheetID)
    var sheet = ss.getSheetByName(SheetName);
    var range = sheet.getDatarange();
    var data = range.getValues();
     
    function project_Notification() {
     
     Logger.log(sheet.getLastRow() + " Is the last Row.");
     for (var row = 1; row < sheet.getLastRow(); row++) {
       var Notification = (data[row][12])
       var Email_sent = (data[row][13])
       var Admin_email = (data[row][5])
       if (Notification == "Yes" && Email_sent == "" && Admin_email != "") {
         Logger.log(Notification)
         SendEmailConfirmation(data[row][5],data[row][1],data[row][14],data[row][3],data[row][6],data[row][9],data[row][10],data[row][11])
         var Notification_cell = sheet.getRange("N" + (row + 1));
         Logger.log("N" + (row + 1))
         var Today = Utilities.formatDate(new Date(),"GMT","dd/MM/yyyy");
         Notification_cell.setValue(Now);
       }
     }
    }
     
    function SendEmailConfirmation(email,Company,Admin_Name,Manager_Email,Landing_Page,QL_code,QL_url,PS_code) {
     if (email != "" && Landing_Page != "") {
         Logger.log(email)
     
         var admin = {
           "name": Admin_Name,"company": Company,"landingPage": Landing_Page,"QLcode": QL_code,"QLurl": QL_url,"PScode": PS_code
         };
     
         var html1 = HtmlService.createTemplateFromFile(''Index1.html'');
           html1.name = admin.name;
           html1.comp = admin.company;
           html1.landingPage = admin.landingPage;
           html1.qlcode = admin.QLcode;
           html1.qlurl = admin.QLurl;
         var html2 = HtmlService.createTemplateFromFile(''Index2.html'');
           html2.name = admin.name;
           html2.comp = admin.company;
           html2.landingPage = admin.landingPage;
           html2.qlcode = admin.QLcode;
           html2.qlurl = admin.QLurl;
           html2.pscode = admin.PScode;
     
         var aliases = GmailApp.getAliases();
         Logger.log(aliases);
         if (aliases.length > 0 && Landing_Page == "Product1") {
           GmailApp.sendEmail(email,"Get started with your trial on Product1",'''',{
             ''from'': "product1@gmail.com",replyTo: "product1@product.com",cc: Manager_Email,htmlBody: html1.evaluate().getContent()
           });
         } else if (Landing_Page == "Product2") {
           GmailApp.sendEmail(email,"Get started with your trial on Product2",{
             ''from'': "product2@gmail.com",replyTo: "product2@product.com",htmlBody: html2.evaluate().getContent()
           });
         }
         else {
           GmailApp.sendEmail("products-admins@gmail.com",''Script error'',''Please check the Products overview sheet for errors.'');
         }
     }
    }
    //Send email for a confirmation that the script run correctly
    

    解决方法

    如何使用 Apps 脚本通过电子邮件从云端硬盘发送附件。

    attachments 有一个 GmailApp.sendEmail() 高级参数。参数为:

    GmailApp.sendEmail(recipient,subject,plainTextBody,options);
    

    使用您的示例,脚本的当前状态是:

    GmailApp.sendEmail(email,"Get started with your trial on Product1",'''',{
             ''from'': "product1@gmail.com",replyTo: "product1@product.com",cc: Manager_Email,htmlBody: html1.evaluate().getContent()
           });
    

    options 中,您可以使用许多高级参数。您正在使用:

    {
             ''from'': "product1@gmail.com",htmlBody: html1.evaluate().getContent()
    }
    

    为此,您可以将 attachments 参数添加为 BlobSource 列表。

    要从 Drive 文件中获取 blob 源,您需要获取此文件的 ID,一旦获得,您就可以像这样获取 blob:

    const file = DriveApp.getFileById("[FILE_ID]")
    const blob = file.getBlob()
    

    当您将其传递给 array 时,请记住将其包含在 sendEmail 的 blob 中,如下所示:

    const file = DriveApp.getFileById("[FILE_ID]")
    const blob = file.getBlob()
    GmailApp.sendEmail(email,htmlBody: html1.evaluate().getContent(),attachments: [blob]
           });
    

    编辑

    要添加各种附件,您可以在列表中添加更多附件:

    const file1 = DriveApp.getFileById("[FILE_ID1]")
    const file2 = DriveApp.getFileById("[FILE_ID2]")
    const blob1 = file1.getBlob()
    const blob2 = file2.getBlob()
    GmailApp.sendEmail(email,attachments: [blob1,blob2]
           });
    

    参考资料

    • sendEmail
    • BlobSource
    • getFileById(id)
    • getBlob()

    我们今天的关于Oracle Apps DBA 常用命令oracle dba_users的分享已经告一段落,感谢您的关注,如果您想了解更多关于89745928/apps: lstat /var/lib/docker/tmp/buildkit-mount589745928/apps: 没有这样的文件或目录、Apps Script Web Apps 是否受定价和配额限制?、Apps Script WebApp - 从谷歌工作表中的数据更新文本框字段 Google Apps 脚本方面:Javascript 端:、Apps 脚本 - 将附件添加到电子邮件确认 如何使用 Apps 脚本通过电子邮件从云端硬盘发送附件编辑参考资料的相关信息,请在本站查询。

    本文标签: