使用vbs傳送email的模板

2021-10-01 17:21:04 字數 1671 閱讀 2393

sub includefile (fspec)

dim filesys, file, filedata

set filesys = createobject ("scripting.filesystemobject")

set file = filesys.opentextfile (fspec)

filedata = file.readall ()

file.close

executeglobal filedata

set file = nothing

set filesys = nothing

end sub

includefile "body.vbi"

' sdt 為今日日期的字串,比如 '2010-12-9',可用於附件名字裡

sdt = formatdatetime(date)

' 注意:以單引號'開頭的行為注釋

' receiptions 為收件人列表,多個收件人之間用分號隔開

' subject 為郵件標題

' body 為郵件正文

' attachments 為附件列表,每個附件都需附帶路徑。

receiptions = "***@***.com.cn"

subject = "報告 " & sdt

body = exbody

attachments = array("e:\q.gif","e:\code\python\bug.gif")

' 以下**無需修改

dim xoutlook

dim xmail

on error resume next

if xoutlook is nothing then

end if

set xmail = xoutlook.createitem(olmailitem)

with xmail

.display

dim signature

signature = .htmlbody

.to = receiptions

.subject = subject

.htmlbody = body

.importance = olimportancenormal ' 設定優先順序, olimportancehigh為高優先順序

dim xdoc

if isarray(attachments) then

dim attachment

for each attachment in attachments

.attachments.add attachment

next

end if

.htmlbody = .htmlbody & signature

attach1 = "e:\test.txt"

dim fso, objfile

set fso = createobject("scripting.filesystemobject")

set objfile = fso.getfile(attach1)

if objfile.size > 0 then

.attachments.add attach1

end if

.send

end with

scrapy使用並傳送email

此處是講述如何用scrapy來傳送,那麼不管是何種語言或框架,它的過程都是類似於連線資料庫,需要乙個先構建乙個傳送器,通過對應的埠號,使用者名稱,密碼,以及傳送的文字或命令。當然傳送email此處變成了郵箱和密碼,增加了從哪來 from 到哪去 to 的過程.並以兩種方式來實現 上菜 兩種方式不論是...

使用aspx實現傳送email

using system using system.data using system.configuration using system.collections using system.web using system.web.security using system.web.ui usin...

VBS 使用指令碼自動傳送郵件

email.from mail mail.com 發件人位址 email.to to mail.com 收件人位址 email.subject mail 郵件標題 email.textbody test 郵件正文 email.addattachment c abc.txt 附件 with email...