# com.smtp 库模块帮助文档

## com 成员列表 <a id="com" href="#com">&#x23;</a>

### com.smtp() <a id="com.smtp" href="#com.smtp">&#x23;</a>
基于 CDO.Message 组件的 SMTP 邮件发送客户端  
[CDO.Message]( https://learn.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2003/ms872547%28v%3Dexchg.65%29 )  

[返回对象:comSmtpObject](#comSmtpObject)

## comSmtpObject 成员列表 <a id="comSmtpObject" href="#comSmtpObject">&#x23;</a>

### comSmtpObject.Attachments <a id="comSmtpObject.Attachments" href="#comSmtpObject.Attachments">&#x23;</a>
已添加的附件

### comSmtpObject.Attachments.Delete(1) <a id="comSmtpObject.Attachments.Delete" href="#comSmtpObject.Attachments.Delete">&#x23;</a>
//删除附件,参数指定索引,起始索引为1

### comSmtpObject.Attachments.DeleteAll() <a id="comSmtpObject.Attachments.DeleteAll" href="#comSmtpObject.Attachments.DeleteAll">&#x23;</a>
删除全部附件

### comSmtpObject.Configuration.Fields.Item("配置名") <a id="comSmtpObject.Configuration.Fields.Item" href="#comSmtpObject.Configuration.Fields.Item">&#x23;</a>
配置属性

### comSmtpObject.Configuration.Fields.Item().Value <a id="comSmtpObject.Configuration.Fields.Item" href="#comSmtpObject.Configuration.Fields.Item">&#x23;</a>
配置值

### comSmtpObject.Fields.Item("配置名") <a id="comSmtpObject.Fields.Item" href="#comSmtpObject.Fields.Item">&#x23;</a>
配置属性。  
使用返回对象的 Value 字段读写值

### comSmtpObject.account <a id="comSmtpObject.account" href="#comSmtpObject.account">&#x23;</a>
SMTP 账户名

### comSmtpObject.addRelatedBodyPart(filepath,reference,referenceType) <a id="comSmtpObject.addRelatedBodyPart" href="#comSmtpObject.addRelatedBodyPart">&#x23;</a>
添加内联附件  
- 参数 @filepath: 本地文件路径。  
- 可选参数 @reference:  Content-ID 或 Content-Location 头。  
省略此参数则自动取参数 @1 的文件名部分（包含后缀）。  
- 可选参数 @referenceType: 指定参数 2 的类型，0 为 Content-ID（默认）, 1 为 Content-Location 。  

> 邮件 HTML 中嵌入内联图像时应在 Content-ID 前加上 `cid:`前缀。  
> 例如: `<img src="cid:test.jpg">`。

### comSmtpObject.addfile("字符串参数") <a id="comSmtpObject.addfile" href="#comSmtpObject.addfile">&#x23;</a>
添加附件,支持多参数

### comSmtpObject.authenticate <a id="comSmtpObject.authenticate" href="#comSmtpObject.authenticate">&#x23;</a>
认证设置  
默认值为com.smtp.cdoAuthentication.cdoBasic

### comSmtpObject.bcc <a id="comSmtpObject.bcc" href="#comSmtpObject.bcc">&#x23;</a>
密送

### comSmtpObject.cc <a id="comSmtpObject.cc" href="#comSmtpObject.cc">&#x23;</a>
抄送

### comSmtpObject.charset <a id="comSmtpObject.charset" href="#comSmtpObject.charset">&#x23;</a>
编码

### comSmtpObject.from <a id="comSmtpObject.from" href="#comSmtpObject.from">&#x23;</a>
发件人邮件地址，例如：  
`sender@example.com` 或者 `"Sender" <sender@example.com>`

### comSmtpObject.getConfig(k) <a id="comSmtpObject.getConfig" href="#comSmtpObject.getConfig">&#x23;</a>
返回 @k 指定名称的属性值

### comSmtpObject.gethtml("字符串参数") <a id="comSmtpObject.gethtml" href="#comSmtpObject.gethtml">&#x23;</a>
html邮件内容

### comSmtpObject.html <a id="comSmtpObject.html" href="#comSmtpObject.html">&#x23;</a>
HTML 邮件内容

### comSmtpObject.password <a id="comSmtpObject.password" href="#comSmtpObject.password">&#x23;</a>
发送邮件密码

### comSmtpObject.port <a id="comSmtpObject.port" href="#comSmtpObject.port">&#x23;</a>
SMTP 端口，默认明文发送端口 25，  
端口指定为 465 时自动启用 SSL，否则自动禁用 SSL。  
服务器上如果禁止使用 25 端口发邮件，改为 465 即可。

### comSmtpObject.reply <a id="comSmtpObject.reply" href="#comSmtpObject.reply">&#x23;</a>
应答邮件地址，例如：  
 "Another" <another@example.com>

### comSmtpObject.send() <a id="comSmtpObject.send" href="#comSmtpObject.send">&#x23;</a>
发送邮件,  
可选使用一个false参数禁止更新配置参数

### comSmtpObject.sender <a id="comSmtpObject.sender" href="#comSmtpObject.sender">&#x23;</a>
实际发件人邮件地址，例如：  
`sender@example.com` 或者 `"Sender" <sender@example.com>`

### comSmtpObject.sendusing <a id="comSmtpObject.sendusing" href="#comSmtpObject.sendusing">&#x23;</a>
发送方式

### comSmtpObject.server <a id="comSmtpObject.server" href="#comSmtpObject.server">&#x23;</a>
smtp服务器

### comSmtpObject.setConfig(k,v) <a id="comSmtpObject.setConfig" href="#comSmtpObject.setConfig">&#x23;</a>
修改 @k 指定名称的属性值为 @v

### comSmtpObject.setMailHeader <a id="comSmtpObject.setMailHeader" href="#comSmtpObject.setMailHeader">&#x23;</a>

```aardio
comSmtpObject.setMailHeader(  
	["return-receipt-to"] = "回执电邮地址";  
	["disposition-notification-to"] = "回执电邮地址";  
)
```

### comSmtpObject.ssl <a id="comSmtpObject.ssl" href="#comSmtpObject.ssl">&#x23;</a>
是否启用 SSL。  
启用 SSL 则自动设置端口为 465，禁用 SSL 时端口自动设为 25。

### comSmtpObject.subject <a id="comSmtpObject.subject" href="#comSmtpObject.subject">&#x23;</a>
邮件标题

### comSmtpObject.text <a id="comSmtpObject.text" href="#comSmtpObject.text">&#x23;</a>
文本邮件内容

### comSmtpObject.textCharset <a id="comSmtpObject.textCharset" href="#comSmtpObject.textCharset">&#x23;</a>
文本编码

### comSmtpObject.timeout <a id="comSmtpObject.timeout" href="#comSmtpObject.timeout">&#x23;</a>
超时值,以秒为单位

### comSmtpObject.to <a id="comSmtpObject.to" href="#comSmtpObject.to">&#x23;</a>
收件人邮件地址

### comSmtpObject.updateConfig() <a id="comSmtpObject.updateConfig" href="#comSmtpObject.updateConfig">&#x23;</a>
更新配置  

[返回对象:comSmtpObject](#comSmtpObject)

### comSmtpObject.username <a id="comSmtpObject.username" href="#comSmtpObject.username">&#x23;</a>
发送邮件用户名
