Skip to main content
Version: v6.5.0

Get email list

Command Description

Retrieve emails from the Exchange mailbox and return them in array format

Command Prototype

arrayRet = Exchange.GetMailMessages(strDomain ,strUserName ,strPassword ,strServer ,strEmailAutoDiscover ,strSharedMailBox ,strFolderName ,bUnreadOnly ,bMarkRead ,bAsHtml ,iTop)

Command parameter

parameterrequiredtypeDefault valuedescribe
strDomainTruestring""AD domain to connect to
strUserNameTruestring""Exchange account used for sending emails
strPasswordTruestring""Exchange account password for sending emails
strServerTruestring""Exchange server address
strEmailAutoDiscoverTruestring""Use this email address to automatically search for servers, which is effective when the server enables automatic discovery
strSharedMailBoxTruestring""Shared email account linked to Exchange account
strFolderNameTruestring"inbox"The email folders that need to be obtained, such as "Inbox", "Drafts", "Sent Items" and other folders
bUnreadOnlyTruebooleanTrueDo you only retrieve unread emails
bMarkReadTruebooleanTrueDo you want to mark the unread emails obtained as read
bAsHtmlTruebooleanFalseIs it in HTML format
iTopTruenumber0Specify the number of messages to be obtained. 0 means All

Return result

ArrayRet, Assign the result of running the command to this variable.

Run instance

/*********************************获取邮件列表**************************************
命令原型:
arrayRet = Exchange.GetMailMessages(strDomain ,strUserName ,strPassword ,strServer ,strEmailAutoDiscover ,strSharedMailBox ,strFolderName ,bUnreadOnly ,bMarkRead ,bAsHtml ,iTop)
入参:
strDomain--域.注:要连接的AD域
strUserName--用户名.注:用于发送邮件的Exchange帐户
strPassword--密码.注:用于发送邮件的Exchange帐户密码
strServer--服务器地址.注:Exchange服务器地址
strEmailAutoDiscover--自动发现地址.注:使用该邮箱地址自动搜索服务器,服务器开启自动发现时有效
strSharedMailBox--共享邮箱地址.注:链接至Exchange帐户的共享邮箱帐户
strFolderName--邮箱文件夹.注:需要获取的邮箱文件夹,如"收件箱","草稿","已发送邮件"等文件夹
bUnreadOnly--未读邮件.注:是否只获取未读邮件
bMarkRead--标记为已读.注:是否将获取的未读邮件标记为已读
bAsHtml--html格式.注:是否html格式
iTop--邮件数量.注:指定获取邮件的数量,0为全部获取
出参:
arrayRet--函数调用的输出保存到的变量.
注意事项:

********************************************************************************/
Dim arrayRet = ""
arrayRet = Exchange.GetMailMessages("" ,"" ,"" ,"" ,"" ,"" ,"inbox" ,True ,True ,False ,0)
TracePrint(arrayRet)