国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > VBScript > 正文

vbs定時(shí)發(fā)送郵件的方法與代碼

2019-10-26 17:58:29
字體:
供稿:網(wǎng)友
'用VBS寫個(gè)腳本,然后用WINDOWS平臺(tái)下的計(jì)劃任務(wù)來調(diào)用,每天定時(shí)群發(fā)郵件. 
'代碼如下:  下載地址 http://www.51tiao.com/info.vbs
復(fù)制代碼 代碼如下:

Dim connstr,conn 
Dim sql,rs,msg 

Sub OpenDB() 
    ConnStr = "DSN=51tiao.Com;UID=sa;PWD=;" 
    If Not IsObject(Conn) Then 
        Set conn = CreateObject("Adodb.Connection") 
        Conn.Open ConnStr 
    End If 
End Sub 

OpenDB() 
Send() 
CloseDB() 

Sub Send() 
    On Error Resume Next '有錯(cuò)繼續(xù)執(zhí)行 
    '郵件內(nèi)容 
    msg = "<html><head><title>上海跳蚤市場(chǎng)今日推薦 "&Date()&"</title>"&VBCRLF _ 
    &"<META NAME=""Author"" CONTENT=""清風(fēng), QQ: 110125707, MSN: anwellsz@msn.com"">"&VBCRLF _ 
    &"<style type='text/css'>"&VBCRLF _ 
    &"<!--"&vbcrlf _ 
    &"td,form,select,input,p,table,.font {font-size: 12px;line-height: 20px}"&VBCRLF _ 
    &"a:link {  color: #000000;  font-size: 12px; text-decoration: none}"&VBCRLF _ 
    &"a:visited {  color: #000000; font-size: 12px; text-decoration: none}"&VBCRLF _ 
    &"a:hover {  color: #ff7f2c; font-size: 12px; text-decoration: underline}"&VBCRLF _ 
    &"-->"&VBCRLF _ 
    &"</style>"&VBCRLF _ 
    &"</head><body>"&VBCRLF _ 
    &"<table width=640>"&VBCRLF _ 
    &"<tr><td align=right>今日推薦信息  "&Year(Date())&"年"&Month(Date())&"月"&Day(Date())&"日  <a href=""http://www.51tiao.com"" target=""_blank""><FONT size=3><b>上海跳蚤市場(chǎng)</b></font></a>    </td></tr></table></div></td></tr></table>"&VBCRLF _ 
    &"<table width=640>"&VBCRLF _ 
    &"<tr bgColor='#FF9D5C'><td height=3></td></tr><tr><td> </td></tr><tr>"&VBCRLF _ 
    &"<td>"&VBCRLF _ 
    &"  <ul>"&VBCRLF _ 
    &"    <p>" 
    sql = "select distinct top 100 a.infoid,a.Strtitle from newinfoarticle a "_ 
    &"inner join Newinfoprop b "_ 
    &"on a.infoid = b.infoid and a.intgood = 1 and a.intshenhe = 1 and b.rid1 = 908 and datediff(d,createtime,getdate())=0 "_ 
    &"order by a.infoid desc" 
    Set rs = conn.execute(sql) 
    If rs.eof Then 
        Wscript.Echo "沒有記錄!" 
        rs.close : Set rs = Nothing 
        Exit Sub 
    End If 
    Do While Not rs.eof 
        msg = msg&"★ <a href=""http://www.51tiao.com/4/Show.asp?ID="&rs("infoid")&""" title = """&rs("strtitle")&""" target=""_blank"">"_ 
        &rs("Strtitle")&"</a><br>"&VBCRLF 
    Rs.MoveNext 
    Loop 
    Rs.close : set Rs=Nothing 
    msg = msg &  "</ul></p>"&VBCRLF _ 
    &"</td>"&VBCRLF _ 
    &"</tr><tr><td> </td></tr><tr bgColor='#FF9D5C'><td height=3></td></tr>"&VBCRLF _ 
    &"<tr align=right><td><a href=""http://www.51tiao.com"" target=""_blank""><FONT face='Arial Black' size=3>51Tiao.Com</FONT></a>      </td></tr>"&VBCRLF _ 
    &"</table><p></p></body></html>" 
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 麟游县| 贵港市| 文安县| 铁岭市| 合水县| 叙永县| 襄城县| 江华| 肥东县| 贺兰县| 广宗县| 蓝山县| 台江县| 栾城县| 鞍山市| 盱眙县| 白水县| 阳江市| 清流县| 安康市| 罗城| 怀化市| 维西| 云梦县| 高尔夫| 元谋县| 界首市| 万州区| 荃湾区| 肥西县| 神池县| 武清区| 呼伦贝尔市| 玉屏| 丰都县| 海城市| 淮阳县| 三河市| 建瓯市| 云阳县| 小金县|