- //默认为当天日期。若要发送前1天数据则-1,前2天数据则-2,以此类推。
- set "rar=C:\Program Files\WinRAR\WinRAR.exe"
- echo wscript.echo dateadd("d",-3,date) >tmp.vbs
- for /f "tokens=1,2,3 delims=/" %%i in ('cscript /nologo tmp.vbs') do (
- set /a y=%%i
- set /a m=%%j
- set /a d=%%k
- )
- if %m% LEQ 9 set m=0%m%
- if %d% LEQ 9 set d=0%d%
- set date=%y%%m%%d%
- del /s /q tmp.vbs
-
- //【客户名称】
- set pname1=百年万能保险产品
- set pname2=-
- set dir2=D:\每日清算数据测试\%pname1%
- set address=fusc1@cmschina.com.cn
- set message=如有疑问,请致电招商证券沪世纪营业部021-68407557联系或邮件fusc1@cmschina.com.cn;
- cd .
-
- md %dir2%\%date%
- cd %dir2%\%date%
- D:
- echo open 172.21.2.6 9805>>ftp.txt
- echo sjdd21>>ftp.txt
- echo sjdd79*ty>>ftp.txt
- echo binary>>ftp.txt
- echo cd %pname1%\%date%>>ftp.txt
- echo mget *>>ftp.txt
- echo bye>>ftp.txt
- ftp -i -s:ftp.txt
- del ftp.txt
- rar a %pname1%%pname2%%date%.rar *.*
- copy %pname1%%pname2%%date%.rar ..\
-
- //【客户名称】
-
- echo receiptions = "%455545972@qq.com%" > Email_Auto_Send.vbs
- echo Subject = "%pname1%%pname2%%date%" >> Email_Auto_Send.vbs
- echo Body = "附件是%pname1%%pname2%清算数据,请查收。%message%" >> Email_Auto_Send.vbs
- echo Attachments = Array("%dir2%\%pname1%%pname2%%date%.rar") >> Email_Auto_Send.vbs
-
- echo Dim xOutLook >> Email_Auto_Send.vbs
- echo Dim xMail >> Email_Auto_Send.vbs
- echo On Error Resume Next >> Email_Auto_Send.vbs
- echo Set xOutLook = GetObject(, "Outlook.Application") >> Email_Auto_Send.vbs
- echo If xOutLook Is Nothing Then >> Email_Auto_Send.vbs
- echo Set xOutLook = CreateObject("Outlook.Application") >> Email_Auto_Send.vbs
- echo End If >> Email_Auto_Send.vbs
- echo Set xMail = xOutLook.CreateItem(olMailItem) >> Email_Auto_Send.vbs
- echo With xMail >> Email_Auto_Send.vbs
- echo .Display >> Email_Auto_Send.vbs
- echo Dim signature >> Email_Auto_Send.vbs
- echo signature = .HTMLBody >> Email_Auto_Send.vbs
- echo .To = receiptions >> Email_Auto_Send.vbs
- echo .Subject = Subject >> Email_Auto_Send.vbs
- echo .HTMLBody = Body >> Email_Auto_Send.vbs
- echo .Importance = olImportanceNormal >> Email_Auto_Send.vbs
-
- echo Dim xDoc >> Email_Auto_Send.vbs
- echo Set xDoc = xMail.Application.ActiveInspector.WordEditor >> Email_Auto_Send.vbs
-
- echo If IsArray(Attachments) Then >> Email_Auto_Send.vbs
- echo Dim attachment >> Email_Auto_Send.vbs
- echo For Each attachment In Attachments >> Email_Auto_Send.vbs
- echo .Attachments.Add attachment >> Email_Auto_Send.vbs
- echo Next >> Email_Auto_Send.vbs
- echo End If >> Email_Auto_Send.vbs
- echo .HTMLBody = .HTMLBody >> Email_Auto_Send.vbs
- echo If true Then >> Email_Auto_Send.vbs
- echo .Send >> Email_Auto_Send.vbs
- echo Else >> Email_Auto_Send.vbs
- echo .Display >> Email_Auto_Send.vbs
- echo End If >> Email_Auto_Send.vbs
- echo End With >> Email_Auto_Send.vbs
- Email_Auto_Send.vbs
- del Email_Auto_Send.vbs
- //——————————
复制代码 上面是代码,发邮件报错
windows 无法访问指定设置路径 或者文件 报的是Email_Auto_Send.vbs 这个vbs这里,这会是啥问题,用的是outlook,有知道的吗,谢谢 |