PLSQL邮件发送程序
邮件发送操作规程

邮件发送操作规程一、背景介绍随着信息化的快速发展和互联网的普及应用,电子邮件已成为日常工作和生活中不可或缺的通讯方式之一。
为了保证邮件的发送准确、及时、安全,制定邮件发送操作规程是非常必要的。
本文将介绍邮件发送的步骤和注意事项,以确保邮件的顺利发送和接收。
二、操作步骤1. 登录邮箱在使用电子邮件发送邮件之前,首先需要登录邮箱账号。
打开邮件客户端(如Outlook、Foxmail等),输入邮箱账号和密码进行登录。
确保账号和密码的准确性,防止登录失败或者账号被盗用。
2. 创建新邮件成功登录邮箱后,在邮件客户端界面找到“写信”、“新建邮件”按钮,点击进入邮件编辑界面。
在收件人栏中输入邮件接收方的邮箱地址,以逗号分隔可同时发送给多人。
根据邮件的需求可填写抄送、密送信息。
3. 填写邮件主题邮件主题应简明扼要地概括邮件的内容,方便接收方快速了解邮件的目的。
避免过长的主题,增加邮件的清晰度。
4. 编写邮件正文在邮件编辑界面的正文部分,按照邮件的目的和内容进行详细描述。
语句通顺、简洁明了,并确保表达清晰。
若有需要,可以使用分段来区分不同的内容。
5. 添加附件如果需要在邮件中添加附件,可以通过点击“添加附件”按钮选择本地的文件进行上传。
上传完成后,附件将作为邮件的一部分发送给接收方。
注意,添加附件时需确保附件的格式和大小符合要求。
6. 校对和发送在完成邮件正文和附件添加后,进行邮件的校对工作。
检查邮件的格式、内容、附件等是否正确无误。
确保邮件没有拼写错误、语法错误,并对附件的完整性进行核对。
校对完成后,点击“发送”按钮将邮件发送出去。
三、注意事项1. 邮箱安全在登录邮箱时,确保使用安全、可信的设备和网络。
避免在公共电脑上登录或者使用不安全的网络环境。
定期更换密码,并避免使用弱密码,以确保邮箱的安全性。
2. 网络连接在发送邮件时,需确保网络连接的稳定性和可靠性,避免因网络问题导致邮件发送中断或失败。
若遇到网络异常,可暂停发送,待网络恢复后再继续操作。
SQL自动发邮件

SQL自动发邮件数据库邮件是从 SQL Server数据库引擎中发送电子邮件的企业解决方案。
通过使用数据库邮件,数据库应用程序可以向用户发送电子邮件。
邮件中可以包含查询结果,还可以包含来自网络中任何资源的文件。
1、数据库邮件配置使用SQL Server Management Studio连接到数据库服务器后,可按下面示意图一步步配置数据库邮件。
(1)、在SQL Server Management Studio的数据库实例的管理菜单下,选中数据库邮件菜单,然后邮件选择:配置数据库邮件。
(2)、在选择配置任务页面,选择通过执行以下任务来安装数据库邮件。
(3)、在新建配置文件界面,首先录入配置文件名及说明信息,然后点击下图所示“添加”按钮,开始添加当前配置文件对应的SMTP账户。
(4)、按下图所示,录入SMTP账户信息,其中最重要的是服务器名称选项。
若使用当前流行的邮件服务提供商的SMTP服务,则一般还需要在基本身份验证部分录入邮箱账户身份信息。
(5)、在上一步添加完账户信息并点击确定后,新增的账户信息将列示在下图的SMTP账户列表中。
一个配置文件是可以和多个账户关联的,因而可以重复前面步骤添加其它SMTP账户信息。
(6)、在该步骤选择“公共”复选框及“默认配置文件”。
(7)、此步骤主要是配置数据库邮件参数,若无特殊要求,默认即可。
(8)、下图展示刚配置的信息。
(9)、系统开始根据前面的配置信息自动配置系统。
如果一切ok,将会展示类似下图信息,点击关闭完成配置。
(10)、按照上述步骤,配置好数据库邮件后,可进行数据库邮件测试,以确认配置是否完全正确。
在SQL Server Management Studio的数据库实例的管理菜单下,选中数据库邮件菜单,然后邮件选择:发送测试电子邮件…。
(11)、在弹出的测试邮件发送配置界面,维护好相关信息后,点击“发送测试电子邮件”功能按钮开始发生邮件。
(12)、系统对测试电子邮件进行列队以进行发送。
OraclePLSQL通过SMTP发送E-MAIL邮件代码

OraclePLSQL通过SMTP发送E-MAIL邮件代码登录到SMTPserver发送邮件,⽀持HTMLCREATE OR REPLACE PROCEDURE send_mail(p_recipient VARCHAR2, -- 邮件接收⼈p_subject VARCHAR2, -- 邮件标题p_message VARCHAR2 -- 邮件正⽂)IS--以下四个变量请依据实际邮件server进⾏赋值v_mailhost VARCHAR2(30) := ''; --SMTPserver地址v_user VARCHAR2(30) := 'system@'; --登录SMTPserver的usernamev_pass VARCHAR2(20) := 'System123'; --登录SMTPserver的passwordv_sender VARCHAR2(50) := 'system@'; --发送者邮箱。
⼀般与 ps_user 相应v_conn UTL_SMTP. connection ; --到邮件server的连接v_msg varchar2(4000); --邮件内容BEGINv_conn := UTL_SMTP.open_connection(v_mailhost, 25);UTL_SMTP.ehlo(v_conn, v_mailhost); --是⽤ ehlo() ⽽不是 helo() 函数--否则会报:ORA-29279: SMTP 永久性错误: 503 5.5.2 Send hello first.UTL_mand(v_conn, 'AUTH LOGIN' ); -- smtpserver登录校验UTL_mand(v_conn,UTL_RAW.cast_to_varchar2(UTL_ENCODE.base64_encode(UTL_RAW.cast_to_raw(v_user))));UTL_mand(v_conn,UTL_RAW.cast_to_varchar2(UTL_ENCODE.base64_encode(UTL_RAW.cast_to_raw(v_pass))));UTL_SMTP.mail(v_conn, v_sender); --设置发件⼈UTL_SMTP.rcpt(v_conn, p_recipient); --设置收件⼈-- 创建要发送的邮件内容注意报头信息和邮件正⽂之间要空⼀⾏v_msg := 'Date:' || TO_CHAR(SYSDATE, 'dd mon yy hh24:mi:ss' )|| UTL_TCP.CRLF || 'From: ' || '<' || v_sender || '>'|| UTL_TCP.CRLF || 'To: ' || '<' || p_recipient || '>'|| UTL_TCP.CRLF || 'Subject: ' || p_subject|| UTL_TCP.CRLF || 'Content-Type:text/html;charset=GBK'|| UTL_TCP.CRLF || UTL_TCP.CRLF -- 这前⾯是报头信息|| p_message; -- 这个是邮件正⽂UTL_SMTP.open_data(v_conn); --打开流UTL_SMTP.write_raw_data(v_conn, UTL_RAW.cast_to_raw(convert(v_msg,'ZHS16GBK'))); --这样写标题和内容都能⽤中⽂UTL_SMTP.close_data(v_conn); --关闭流UTL_SMTP.quit(v_conn); --关闭连接EXCEPTIONWHEN OTHERS THENDBMS_OUTPUT.put_line(DBMS_UTILITY.format_error_stack);DBMS_OUTPUT.put_line(DBMS_UTILITY.format_call_stack);END send_mail;。
How to send emails with attachments from PLSQL stored procedures

How to send emails with attachments from PL/SQL stored proceduresI was looking for some documentation in order to implement a function that can send an email with attachments from a PL/SQL stored procedure.Was kind of difficult to find very good documentation although this is a very simple process, specially about how to implement the function of sending some text as an attached file.The are 2 main approaches to solve this problem:1. UTL_SMTP: Available in Oracle 8i and 9i (for 10g use UTL_MAIL), is not easy to use to send emails with attached files but if you understand the concept of how the SMTP server handles this will be much easier. I will cover this below.2. Using Java, easier to send attachments but difficult to install and setup (you got to have access to user SYS in order to compile and run some functions in Java and also to run some commands to be able to compile the Java procedure)In this article I will refer to the first approach, using UTL_STMP. I will save the Java approach for a later post in this blog.How does SMTP work to send attachments?What the SMTP server does in order to send an email with a text file attached it's to get the text that arrives in one of the parameters or arguments passed to the function. The SMTP receives the text and encodes or decodes the text on the fly, depending if it's sending or receiving the email. So when it arrives to your computer it's when it gets'translated' into a certain type of file.This is the way that the process of sending a TXT attachment works. The SMTP server uses some commands to send the text and not the file itself. This means that contents when arrive to the destination will be stored as an attached file.This the reason why when sending an attached file it's not needed to specify a path. You just pass the contents which will be encoded or decoded on the fly when receiving or sending the email...I don't know why is that NOBODY explains this simple but very usefulconcept. All the sites that I have seen only bother to put the code of the functions needed to send email with attachments but nobody explains anything, the 'know-how' it's kept as a secret.Now that you know how SMTP works let's get into action using PL/SQLUsing UTL_SMTP to send mails with attachmentsUTL_SMTP, as the name itself referes, it's a UTiLity Package included by default in Oracle Database since 8i release. It has some built in functions and procedures that basically provide an interface with the SMTP protocol commands. So the idea behind it's to interact with the SMTP server initiating and mantaining a conversation to achieve the functionality of sending emails from any stored procedure defined in PL/SQLTo implement this functionality inside your PL/SQL procedures, some functions have to be called; there is no need to initialize/setup the package because it comes pre-installed in the database server. Check the functions used, the parameters are self explanatory and the variables have to be declared previously.Note that to send the attachment there is no need to call an specific function, the action of initializing some parameters, like the file name that will contain the attached text when the email it reaches its destination, is the only thing needed by the STMP server to send an email including text as an attachment.-- initiate the conversation with the SMTP server, establishing the connectionv_smtp_connection := utl_smtp.open_connection( v_smtp_host,v_smtp_port );-- perform a handshake with the SMTP serverutl_smtp.helo( v_smtp_connection, v_smtp_host );-- sender (from) addressv_sender:= user@-- set the 'from' address of the messageutl_smtp.mail( v_smtp_connection, v_sender );-- recipient (to) addressv_sender:= user@-- set the 'to' address of the messageutl_smtp.rcpt(v_smtp_connection, v_recipient);-- send the email, using char(13) it's a way to pass the parameters to the SMTP serverutl_smtp.data(v_smtp_connection,'Single string message.' || Chr(13));-- close the connectionUTL_SMTP.quit(l_mail_conn);Sample CodeThis code it's to demonstrate the use of the UTL_SMTP package in a real life piece of working code that I use on a application implemented for a datamart application in an actual project that I am working on. Look that the text to be attached comes as a parameter to the function, it can hold up to 32768 characters long, if you need you can use a CLOB datatype which can handle up to 4 Gigs. There is also a place to name the file name that will hold the attached text once it reaches its destination.The values To, Cc, Bcc are only used to display the recicpients of the email in a certain way in the email client (Hotmail, Eudora, Outlook, Yahoo, etc) . The values on this fields have nothing to do actually with the mechanism that sends the email as this fields are used only for representation purposes of how the recipients will be shown in each email client who will be used to read the email.This function is commonly used in applications to send results from queries and it's usually used inside a for cursor loop.Function send_mail(v_recipient varchar2, -- Field To of the emailv_subject varchar2, -- Subject of the emailv_body varchar2, -- Body of the emailv_attachmentvarchar2, -- Text that will be sent as an attached filev_error_msg out varchar2) -- To hold the errors in the exception section return boolean is-- variable to hold the smtp server connectionv_smtp_connectionutl_smtp.connection;-- variable to hold the smtp host namev_smtp_host varchar2(100) default 'my_';-- variable to hold the smtp portv_smtp_port number default 25;-- variable to hold the sender, from fieldv_sender varchar2(100) default 'user@';begin-- establish the connection to the smtp serverv_smtp_connection := utl_smtp.open_connection(v_smtp_host,v_smtp_port);-- perform a handshake with the smtp serverutl_smtp.helo(v_smtp_connection, v_smtp_host);-- set the 'from' address of the messageutl_smtp.mail(v_smtp_connection, v_sender);-- add the recipient to the messageutl_smtp.rcpt(v_smtp_connection, v_recipient);-- send the emailutl_smtp.data(v_smtp_connection,'Date: ' || to_char(sysdate, 'DD-MON-YYYY HH24:MI:SS') || utl_tcp.crlf ||'From: ' || v_sender || utl_tcp.crlf ||'Subject: '|| v_subject || utl_tcp.crlf ||'To: ' || v_recipient || utl_tcp.crlf ||'Cc: ' || v_cc || utl_tcp.crlf ||'MIME-Version: 1.0'|| utl_tcp.crlf || -- use Mime mail standard'Content-Type: multipart/mixed;' || utl_tcp.crlf ||' boundary="-----SECBOUND"'|| utl_tcp.crlf ||utl_tcp.crlf ||'-------SECBOUND'|| utl_tcp.crlf ||'Content-Type: text/html;'|| utl_tcp.crlf ||'Content-Transfer_Encoding: 8bit'|| utl_tcp.crlf ||utl_tcp.crlf ||v_body || utl_tcp.crlf || -- message bodyutl_tcp.crlf ||'-------SECBOUND'|| utl_tcp.crlf ||'Content-Type: text/plain;' || utl_tcp.crlf ||' name="error.log"'|| utl_tcp.crlf || -- file name that will hold the attached text'Content-Transfer_Encoding: 8bit'|| utl_tcp.crlf ||'Content-Disposition: attachment;'|| utl_tcp.crlf ||' filename="error.log"'|| utl_tcp.crlf ||utl_tcp.crlf ||v_attachment || utl_tcp.crlf || -- attachmentutl_tcp.crlf ||'-------SECBOUND--' -- end mime mail);-- end the connection to the smtp serverutl_smtp.quit(v_smtp_connection);return true;exceptionwhen utl_smtp.invalid_operation thenv_error_msg := ' Invalid Operation in Mail attempt using UTL_SMTP.'; return false;when utl_smtp.transient_error thenv_error_msg := ' Temporary e-mail issue - try again';return false;when utl_smtp.permanent_error thenv_error_msg := ' Permanent Error Encountered.';return false;end send_mail;If you need any clarifications or you have found some errors in the source code please send me an email to: gongorac@ or drop me a note below.。
如何使用邮件代码发送邮件

如何使用邮件代码发送邮件使用编程语言发送邮件需要使用到相应的库或模块。
以下是不同编程语言中的示例代码。
1. Python:Python中最常用的库是smtplib和email。
下面是一个使用python 发送邮件的示例代码:```pythonimport smtplibfrom email.mime.text import MIMETextfrom email.utils import formataddrdef send_email(sender_email, sender_password,recipient_email, subject, message):try:msg = MIMEText(message, 'plain') # 创建邮件正文msg['Subject'] = subject # 邮件主题server.starttls( # 启用TLS加密server.sendmail(sender_email, [recipient_email],msg.as_string() # 发送邮件server.quit( # 退出服务器print("邮件发送成功")except Exception as e:print("邮件发送失败:", str(e))#使用示例sender_password = "password"subject = "Example Subject"message = "This is the content of the email."send_email(sender_email, sender_password, recipient_email, subject, message)```2. Java:Java中可以使用JavaMail API来发送邮件。
pop3的工作流程

pop3的工作流程
POP3(Post Office Protocol Version 3)是一种电子邮件传输协议,用于从邮件服务器上下载电子邮件。
其工作流程如下:
1. 建立连接:客户端应用程序通过TCP/IP协议建立与邮件服务器的连接。
POP3服务器监听110号TCP端口。
2. 身份验证:客户端发送用户名和密码给POP3服务器进行身份验证。
若验证成功,则可以执行后续操作。
3. 邮件列表:客户端发起LIST命令,POP3服务器返回用户在邮件服务器上的所有邮件数量及邮件的编号。
4. 邮件下载:客户端通过RETR命令指定邮件编号,POP3服务器返回该邮件的内容,并标记为已经下载过的。
5. 删除邮件:如果客户端想删除邮件,可以通过DELE命令请求POP3服务器将该邮件从邮件服务器上删除。
但是被删除的邮件并不会立即从服务器中移除,而是标记为已经删除,等待后续的删除操作。
6. 关闭连接:客户端可以通过QUIT命令关闭与POP3服务器的连接。
如果存在被删除但未真正移除的邮件,则POP3服务器会在此时进行清理。
注:POP3只能下载邮件,在进行邮件操作时,需要注意邮件的备份。
plsql 用法

plsql 用法什么是PL/SQL?PL/SQL(Procedural Language/Structured Query Language)是一种过程化编程语言,专门用于Oracle数据库的管理和数据操作。
PL/SQL结合了SQL语句和传统的过程化编程语言,为开发人员提供了一种用于编写存储过程、触发器、函数和包的强大工具。
PL/SQL的特点和优势1. 数据库集成:PL/SQL是与Oracle数据库紧密集成的编程语言,可以直接操作数据库对象,如表、视图、索引等。
PL/SQL代码可以嵌入SQL 语句中,也可以在应用程序中直接调用。
2. 强大的处理能力:PL/SQL提供了丰富的控制结构和处理能力,支持条件判断、循环、异常处理等功能。
开发人员可以使用PL/SQL编写复杂的业务逻辑,处理数据、逻辑流程和错误情况。
3. 单元测试:PL/SQL可以编写单元测试用例,对存储过程和函数进行测试。
这样可以在开发过程中及时发现错误,并保证代码的可靠性和健壮性。
4. 高性能:与SQL语句相比,PL/SQL代码在数据库中的运行速度更快。
PL/SQL代码可以减少与数据库的多次交互,优化查询和数据处理。
5. 可重用性:PL/SQL代码可以封装在存储过程、函数和包中,提供了一种可重用的代码组织方式。
这样可以降低开发时间和维护成本。
PL/SQL的基本语法和结构PL/SQL的语法和常见编程语言类似,包括变量声明、控制结构、循环和条件判断等。
下面是PL/SQL的一些基本语法和结构:1. 变量声明:使用关键字DECLARE声明变量,并指定变量的数据类型。
例如:plsqlDECLAREemp_name VARCHAR2(50);emp_salary NUMBER(10,2);BEGIN声明变量并进行赋值emp_name := 'John Doe';emp_salary := 5000.00;END;2. 控制结构:PL/SQL提供了条件判断和循环等控制结构,用于控制程序的流程。
python自动发送邮件的方法

python自动发送邮件的方法使用Python发送邮件需要使用到smtplib、email库。
以下是一个简单的Python程序,用于通过SMTP服务器发送电子邮件。
```pythonimport smtplibfrom email.mime.text import MIMEText# 邮箱服务器地址mail_host = "smtp.gmailXXX"# 邮箱用户名mail_user = "your_email_address"# 邮箱密码mail_pass = "your_email_password"# 发送方邮箱地址sender = "your_email_address"# 接收方邮箱地址receivers = ["receiver_email_address"]# 邮件主题subject = "Test Email"# 邮件内容message = MIMEText("This is a test email sent by Python.") # 设置发件人、收件人、主题message["From"] = sendermessage["To"] = ",".join(receivers)message["Subject"] = subjecttry:# 连接邮箱服务器smtpObj = smtplib.SMTP(mail_host, 587)smtpObj.starttls()# 登录邮箱smtpObj.login(mail_user, mail_pass)# 发送邮件smtpObj.sendmail(sender, receivers, message.as_string()) print("邮件发送成功")except smtplib.SMTPException as e:print("Error: 无法发送邮件", e)# 关闭连接smtpObj.quit()```请注意,要成功发送电子邮件,请在代码中将“your_email_address”和“your_email_password”替换为您自己的邮箱地址和密码。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
北京源智天下科技有限公司
1-8
联系方式:
电子邮件发送流程图
连接并接受电子邮件服 务器验证
分析p_to收件人列表, 对具有多个收件人的依
次添加到列表中
发送From、To和Subject 主题消息
传送MIME版本
指定内容类型为 multipart/mixed
北京源智天下科技有限公司
1-4
联系方式:
使用UTL_ SMTP发送电子邮件
北京源智天下科技有限公司
1-5
联系方式:
系统总体流程
初始化部分
邮件收件人列表
写入邮件正文 发送并关闭
写入Excel数据
写入文件附件
写入HTML文件 数据
• (1)使用统一的邮件发送API发送电子邮件,避免因为直接使用UTL_SMTP导致的代容格式。
• (3)支持邮件收件人管理,将所有的收件人写入到一张表中,通过查询表来获取收件 人列表,进行邮件的发送。
• (4)提供对邮件内容的HTML和Excel格式附件发送,以便相关人员获取到异动的数据 使用Excel进行分析,或者产生HTML报表便于查看。
• xm_data过程:向邮件内容中写入文本邮件内容,支持中文字体的显示。
• xm_html过程:使用xm_init返回的UTL_STMP.connection对象,向邮件 内容中写入HTML格式的邮件内容。
• xm_file过程:使用xm_init返回的UTL_STMP.connection对象,向邮件中 绑定要发送的邮件附件内容。
• (3)邮件收件人列表是硬编码到程序代码中,当收件人发生变化时,不得不通知IT部 门更改邮件收件人,不能及时进行有效的收件人管理。
• (4)不能发送Excel和HTML格式的邮件,对于一些数据的分析不得不使用相关工具转 为Excel格式再进行分析,浪费了不少职员的时间。
• IT部门根据上述的分析,发现需要开发一套统一的邮件发送程序,要求能够解决上面提 出的所有这些问题,因此邮件发送程序的需求如下:
xm_worksheet
wb_header
xm_ws_row
xm_ws_sql
wb_footer
xm_close过程
ws_footer
北京源智天下科技有限公司
联系方式:
xm_init初始化流程图
1-12
使用游标FOR循环
游标是否移到集合尾部
开始写入类型为text/ plain的纯文本格式邮件
写入邮件主体内容
输出结束分隔符
北京源智天下科技有限公司
1-9
联系方式:
定义包规范
• xm_init函数:该函数返回mail_connection记录类型的对象,用来初始化 UTL_SMTP的连接对象,这个函数将使用在包公共变量中定义的邮件服务 器地址、服务器身份验证的用户名和密码,初始化连接后,会写入MIME信 息用来处理文本内容的发送,但是该函数并不真正发送,只是准备发送内容 。
北京源智天下科技有限公司
1-7
联系方式:
MIME邮件内容示意图
Content-Type: multipart/mixed; boundary="DMW.Boundary.605592468
Content-Type: text/plain; charset=utf-8
• wb_footer过程:写入Excel工作薄中的工作薄的尾信息。
• ws_footer过程:写入Excel工作表的工作表尾信息。
北京源智天下科技有限公司
1-10
联系方式:
包规范的调用顺序
1-11
xm_data
xm_init函数
xm_html
xm_file
北京源智天下科技有限公司
1-6
联系方式:
系统编码实现
• 认识MIME类型 • 实现MIME类型邮件发送 • 定义包规范 • 邮件初始化函数xm_init • 发送并关闭连接xm_close • 发送HTML邮件 • 发送邮件附件 • 发送Excel附件内容 • 写入工作薄wb_header • 写入工作表xm_worksheet • 写入表格行xm_ws_row • 写入工作表尾信息 • 执行SQL语句写入工作表
PL/SQL从入门到精通视频
第二十讲:PL/SQL邮件发送程序
北京源智天下科技有限公司
联系方式:
课程安排
• 系统设计 • 系统编码实现 • 编译和部署应用程序
北京源智天下科技有限公司
1-2
联系方式:
系统设计
• 程序需求简介 • 使用UTL_ SMTP发送电子邮件 • 系统总体流程 • 示例环境的搭建
北京源智天下科技有限公司
1-3
联系方式:
程序需求简介
• 邮件通知出现了如下的问题:
• (1)邮件的格式多种多样,无法很清楚的辩识是哪个系统的哪些数据出现了问题。
• (2)有时候因为发送邮件主机变动,导致一些PL/SQL后台程序没有正常发送邮件, 主要原因在于SMTP主机的相关信息没有及时更改。
MIME内容边界
--DMW.Boundary.605592468
Content-Type: text/html
MIME内容边界
--DMW.Boundary.605592468
Content-Type: application/octet-stream
MIME内容边界
--DMW.Boundary.605592468
• xm_worksheet过程:向邮件内容中写入Excel工作表的头信息。
• xm_ws_row过程:根据传入的参数向Excel工作表内容中写入行信息。
• xm_ws_sql过程:动态执行SQL语句,向Excel工作表中写入行信息。
• xm_close过程:发送电子邮件并关闭连接通道。
• wb_header过程:写入Excel工作薄中的工作薄的头信息。