Files
playbook/skills/tsl-api-reference/references/codegen/builtin/object/pop3.md
T
csh 9010829c6d feat(tsl-api-reference): expand and reorganize api catalog
Flatten builtin pages, add third-party and platform scopes, and import financial and data warehouse references.

Keep the existing generated index without rebuilding after signature normalization.
2026-08-10 18:26:24 +08:00

6.9 KiB

Object - Pop3 邮件接收

Pop3

声明:class

Pop3 内置对象

create(host, user_name, password)

声明:function

创建 Pop3 实例

可见性:public

参数 类型 说明
host string 可选。字符串类型。如果指定了Host参数,会自动从Pop3配置文件里获取其他相应参数,并自动连接
user_name string 可选。字符串类型,用户名
password string 可选。字符串类型,密码。如果该参数不指定,而指定了HOST,USERNAME参数,则在POP3配置文件里获取密码

capa()

声明:function

取服务器的支持命令列表

可见性:public

返回:string

示例

//创建pop3对象
pop3Obj := new pop3("pop3.tinysoft.com.cn","username","password");
return pop3Obj.CAPA();

checkMessages()

声明:function

返回邮件的个数

可见性:public

返回:integer

示例

//登陆并返回邮箱中邮件数量
ret:=CreateObject('PoP3','POP3.TINYSOFT.COM.CN',uname,password);
return ret.CheckMessages();//返回整数

connect()

声明:function

连接服务器

可见性:public

返回:any

示例

ret:=CreateObject('Pop3');
//通过属性设置后再连接
ret.Username:=uName;
ret.Password:=passWord;
ret.Host:='POP3.TINYSOFT.COM.CN';
ret.Port:=110;
ret.UseTLS:=0;
ret.Connect(); //连接邮箱服务器
return ret.CheckMessages();

delete(msg_id)

声明:function

删除指定的邮件,返回删除是否正确

可见性:public

参数 类型 说明
msg_id any msg_id

返回:boolean

disconnect()

声明:function

断开连接

可见性:public

返回:any

disconnectNotifyPeer()

声明:function

断开并且通知服务器

可见性:public

返回:any

keepAlive()

声明:function

发送空指令保持服务的连接

可见性:public

返回:any

login()

声明:function

登录,此前必须制定Username和Password属性

可见性:public

返回:any

reset()

声明:function

复位,撤销所有本次会话中的删除操作

可见性:public

返回:boolean

retrieve(msg_id, msg)

声明:function

取邮件的内容

可见性:public

参数 类型 说明
msg_id integer 邮件ID
msg TSLObj 获取成功时返回的邮件内容,具体类型可参考FAQ: MailMsg对象

返回:boolean

retrieveHeader(msg_id, msg)

声明:function

取邮件的内容,仅仅取邮件的头部信息,不取附件等内容

可见性:public

参数 类型 说明
msg_id integer 邮件ID
msg TSLObj 获取成功时返回的邮件头部信息,具体类型可参考FAQ: MailMsg对象

返回:boolean

retrieveMailBoxSize()

声明:function

获取邮箱的大小

可见性:public

返回:integer

示例

//创建pop3对象
pop3Obj := new pop3("pop3.tinysoft.com.cn","username","password");
return pop3Obj.RetrieveMailBoxSize();

retrieveMsgSize(msg_id)

声明:function

取指定邮件的大小

可见性:public

参数 类型 说明
msg_id integer 指定邮件序号

返回:integer

示例

//创建pop3对象
pop3Obj := new pop3("pop3.tinysoft.com.cn","username","password");
return pop3Obj.RetrieveMsgSize(1);

retrieveRaw(msg_id, msg_content)

声明:function

取邮件的原始内容

可见性:public

参数 类型 说明
msg_id integer 邮件ID
msg_content string 获取成功时返回的原始邮件内容

返回:boolean

sendCmd(cmd, cmd_result, ret_code)

声明:function

发送命令

可见性:public

参数 类型 说明
cmd string 字符串类型,发送的命令
cmd_result string 可选。返回的结果串
ret_code string 可选。返回的代码串

返回:integer

示例

ret:=CreateObject('PoP3','POP3.TINYSOFT.COM.CN',uName,password);
r:=ret.SendCmd('UIDL 1',cr,rc);//获取指定邮件的唯一标识
return array(r,cr,rc);

top(msg_id, result, max_lines)

声明:function

取邮件的前N行内容

可见性:public

参数 类型 说明
msg_id integer 指定邮件序号
result string 指定邮件内容返回值
max_lines integer 获取指定邮件前MaxLines行的内容

返回:boolean

示例

//创建pop3对象
pop3Obj := new pop3("pop3.tinysoft.com.cn","username","password");
ret := pop3Obj.Top(1,msg,3);
if ret then return msg;
else return "获取指定邮件前3行内容失败!";

uidl(ids)

声明:function

取服务器的邮件唯一标示列表

可见性:public

参数 类型 说明
ids string 字符串,存放获取到的标示列表

返回:boolean

示例

ret:=CreateObject('PoP3','POP3.TINYSOFT.COM.CN',uname,password);
ret.UIDL(ids); //取服务器的邮件唯一标示列表存放在ids中
return ids;

AuthType

声明:property

认证类型,0:明文用户密码,1:MD5,2:SASL认证,-1:自定义认证

可见性:public

类型:integer

访问:read/write

AuthTypeString

声明:property

自定义认证类型,仅当 AuthType 设置为-1时有效;设置为"AUTH=*":自动选择服务器支持的认证类型;多个用分号连接

可见性:public

类型:string

访问:read/write

AutoLogin

声明:property

是否在连接的时候自动登录

可见性:public

类型:boolean

访问:read/write

Capabilities

声明:property

取服务器的支持命令列表(不重新发送命令)

可见性:public

类型:string

访问:read

HasAPOP

声明:property

是否是MD5认证

可见性:public

类型:boolean

访问:read

HasCAPA

声明:property

是否执行过CAPA命令

可见性:public

类型:boolean

访问:read

Host

声明:property

主机名称或地址

可见性:public

类型:string

访问:read/write

LastCmdResult

声明:property

最后的命令执行结果

可见性:public

类型:string

访问:read

LastCmdResultCode

声明:property

最后的命令执行的返回码

可见性:public

类型:string

访问:read

Password

声明:property

密码

可见性:public

类型:string

访问:read/write

Port

声明:property

主机端口

可见性:public

类型:integer

访问:read/write

Username

声明:property

用户名

可见性:public

类型:string

访问:read/write

UseSTARTTLS

声明:property

是否使用显式 TLS(即 STARTTLS 加密协议)

可见性:public

类型:boolean

访问:read/write

UseTLS

声明:property

是否采用SSL连接

可见性:public

类型:boolean

访问:read/write