下面的批处理代码用到了nc.exe,下载压缩包后将其解压到该批处理所在的目录下。
@echo off
title 批处理发送邮件(只用于163邮箱) by:vkill
set "life=test.conf"
cls
echo 正在检查网络
ping -n 2 smtp.163.com>nul ||(echo 请先检查网络&pause>nul&goto :eof)
:start
cls
::::::::::::::::::::::::::::::::::::::::
:name_b
title 批处理发送邮件→1/5
cls
set name=
set /p name=请输入邮箱用户名:
if *%name%==* goto name_b
echo %name%|findstr "^[0-9a-zA-Z_-=]*$" >nul ||(echo 语法错误,任意键返回&pause>nul&goto name_b)
echo 必须保证和上面base64编码前的是同一用户名
:name__b
set name_=
set /p name_=请输入邮箱用户名(非base64编码的):
if *%name_%==* goto name__b
:pass_b
title 批处理发送邮件→2/5
cls
set pass=
set /p pass=请输入邮箱密码:
if *%pass%==* goto pass_b
echo %pass%|findstr "^[0-9a-zA-Z_-=]*$" >nul ||(echo 语法错误,任意键返回&pause>nul&goto pass_b)
:sjr_b
title 批处理发送邮件→3/5
cls
echo 格式为xxx@xxx.xxx 例如:test@test.com
set sjr=
set /p sjr=请输入收件人:
if *%sjr%==* goto sjr_b
echo %sjr%|findstr "^[0-9a-z]*\@[0-9a-z]*\.[a-z]*$" >nul ||(echo 语法错误,任意键返回&pause>nul&goto sjr_b)
:zt_b
title 批处理发送邮件→4/5
cls
set zt=
set /p zt=请输入邮件的主题:
if *%zt%==* goto zt_b
:zw_b
title 批处理发送邮件→5/5
cls
set zw=
set /p zw=请输入邮件的正文:
if *%zw%==* goto zw_b
::写nc调用的脚本
>%life% echo helo cn-dos
>>%life% echo AUTH LOGIN
>>%life% echo %name%
>>%life% echo %pass%
>>%life% echo mail from: ^<%name_%@163.com^>
>>%life% echo rcpt to: ^<%sjr%^>
>>%life% echo data
>>%life% echo From: %name_%@163.com
>>%life% echo To: %sjr%
>>%life% echo Subject: %zt%
>>%life% echo MIME-Version: 1.0
>>%life% echo Content-Type: text/plain
>>%life% echo.
>>%life% echo %zw%
>>%life% echo .
>>%life% echo quit
pause
cls
echo 正在获取smtp.163.com的ip
for /f "tokens=4 delims= " %%? in ('ping -n 1 smtp.163.com ^|find /i "Ping statistics for"') do (set "ip_=%%?")
set "ip=%ip_::=%"
if *%ip%==* (echo 没有获取到ip,可能网络有问题&pause>nul&goto :eof)
echo %ip%|findstr "^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*$">nul||(echo 没有获取到ip,可能网络有问题&pause>nul&goto :eof)
echo ip获取完成
echo 正在发送邮件
::nc连接smtp.163.com 25执行%life%中的命令发邮件
nc -nvv %ip% 25 <%life%
echo 发送完成,任意键开始继续发送
del /f/q %life%>nul
pause>nul&goto sjr_b
goto :eof
@echo offset "username=用户名"
set "password=你的密码"
start "163邮箱登录中" "https://reg.163.com/logins.jsp?username=%username%&password=%password%&url=http://fm163.163.com/coremail/fcg/ntesdoor2"
复制以上代码,另存为.Bat文件即可。用户名为163的用户名,密码为你帐号的密码
这是自动登入邮箱,下载文件批处理不能实现的
而且你的要求有安全隐患,希望慎重
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)