我在百度上找了一圈,有手工的,但是却没有直接批处理的。
还有说要什么NC的,压根不知道啥是NC...
现在把 ...
dlxg 发表于 2015-1-21 10:56 - @echo off
- REM 变量初始化
- :_start
- cls
- set from=源邮箱xxx@qq.com
- for /f "tokens=1,* delims=@" %%i in ('echo %from%') do (
- set "user=%%i"
- set "server=smtp.%%j"
- )
- cls
- echo echo,用户名:%user% >nul 2>nul
- echo,发送邮箱地址:%from%
- echo echo,服务器:%server% >nul 2>nul
- set pass=源邮箱登录密码xx
- set subj=邮件标题xx
- set x="X-Header-Test: Can Blat do it? Yes it Can!"
- set debug=-log MailLog.log -timestamp
- REM 准备发送邮件
- cd.>MailLog.log
- set /p "to=请输入或你要发送到的目标邮箱地址:"
- echo set /p "content=请输入或拖入你要发送的内容:" >nul 2>nul
- set /p "content=请拖入你要发送的文件附件到这里:"
- set/p="%content%"<nul>$
- :_typeChoice
- 1set /p type="你的输入内容是文件路径[F]还是文本内容[T],请输入[F|T]:" >nul 2>nul
- set type=f
- if /i "%type%" EQU "f" (
- set "mainBody=-body "详见附件" -attach %content%"
- ) else if /i "%type%" EQU "t" (
- set "mainBody=-bodyF $ -html -charset GBK"
- ) else (
- echo,输入内容有误,请重新输入
- pause
- goto :_typeChoice
- )
- blat -server %server% -u %user% -pw %pass% -f %from% -to %to% -s %subj% %mainBody% -debug %debug%
-
- del /f $>nul
- ping 127.0.0.1 -n 10 >nul 2>nul
-
- type MailLog.log
- ping 127.0.0.1 -n 30 >nul 2>nul
-
- del /f /q MailLog.log >nul 2>nul
- exit
复制代码 需要用到blat.exe这个文件。 |