Skip to main content

Send-Mail

Command Description

Send a mail to the specified email address. Return true if succeeds. Return false if fails

Command Prototype

bRet = Outlook.SendMail(account,arryTo,strTitle,strContent,strFormat,arryAttachment,arryCC,arrBCC)

Parameter Description

ParameterRequiredTypeDefaultDescription
accountTruestring""The sender's email address and must be the same as the address bound to Outlook
arryToTruestring""Destination email address
strTitleTruestring""Email suject
strContentTruestring""The content of the email body
strFormatTrueenum"text"Message format
arryAttachmentTruearray['''C:\Users''']Email attachment can be an array of multiple file routes or a single route
arryCCTruestring""CC email address can be an array containing multiple email addresses or a string of a separate email address
arrBCCTruestring""BCC email addresses, can be an array of multiple email addresses, or a string of a separate email address

return

bRet,The variable used to save the output of the command.

Demo

/*********************************send email************** ************************************ 
**Entry 1
** account--sender's email address, which must be the same as the email address bound to Outlook.
**Entry 2
** arryTo--target email address.
**Entry 3
** strTitle--The title of the message.
**Entry 4
** strContent--mail body content.
**Entry 5
** strFormat--mail format.
**Entry 6
** arryAttachment--mail attachment, which can be an array containing multiple attachment paths, or an attachment path string.
**Entry 7
** arryCC--Cc email address, which can be an array containing multiple email addresses, or a single email string.
**Entry 8
** arrBCC--Bcc email address, which can be an array containing multiple email addresses, or a single email string.
**Exit
** bRet--The variable to which the output of the function call is saved.
*****************************************************************************************/
TracePrint "--------------------------------------------Send email (mail format txt) -----------------------------------------"
bRet = Outlook.SendMail("lzz1712@outlook.com","liuzhizheng@laiye.com","Hello","Hello","text",@res"Save as.txt","531874815@ qq.com","")
TracePrint "Output the result after sending the mail:"&CStr(bRet)
TracePrint "----------------------------------------------------------------------------------------------------"

TracePrint "--------------------------------------------Send Mail (Mail format html)--------------------------------------"
bRet = Outlook.SendMail("lzz1712@outlook.com","liuzhizheng@laiye.com","Hello","Hello","html",@res"save as .txt","531874815@ qq.com","wangliang@laiye.com")
TracePrint "Output the result after sending the mail:"&CStr(bRet)
TracePrint "----------------------------------------------------------------------------------------------------"