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 '有错继续执行 '邮件内容 msg = "<html><head><title>上海跳蚤市场今日推荐 "&Date()&"</title>"&VBCRLF _ &"<META NAME=""Author"" CONTENT=""清风, 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>上海跳蚤市场</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>"