- ::p-mailsend.cmd
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: p-mailsend_v4.0 ::
- :: ::
- :: Code by : vkill ::
- :: Thanks : bjsh,est,lxmxm... ::
- :: 出 处 : http://www.vkill.net http://bbs.cn-dos.net ::
- :: 功 能 : 命令行邮件发送程序(群发\多附件\匿名) ::
- :: 原 理 : telnet收发邮件的原理 ::
- :: 最后更新 : 2007-11-12 ::
- :: 程序依赖文件:nc.exe;rar.exe;base64.exe ::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- @echo off&endlocal&setlocal ENABLEDELAYEDEXPANSION
- set "t_=test.conf"
- ::这里是匿名发信的详细设置
- set "匿名="QQ邮箱管理员匿名测试" ^<10000@qq.com^>"
-
- call :del_
- set "oneself=%~f0"
- if "%1"=="" (
- echo 请在命令行下执行 %oneself% /? 查看详细命令行帮助
- ping -n 5 127.1 >nul 2>nul
- goto :eof
- )
- if "%1"=="/?" goto help
- if "%1"=="-?" goto help
- for %%? in (/h,-h,--h) do (if "%~1"=="%%?" goto help)
- echo.
- echo p-mailsend_v4.0 by:vkill
- echo _________________________________________________
-
- set/p=依赖文件完整性检查...<nul
- set "tools_name=nc.exe;rar.exe;base64.exe"
- for %%? in (%tools_name%) do (
- if *%%~$PATH:?==* if not exist %%? (
- echo no,缺失文件%%? &goto :sleep_
- )
- )
- set/p=ok<nul&echo.
-
- set/p=分析参数是否正确...<nul
- set n=0
- if not "%1"=="" (
- :loop_ap
- set/a n+=1
- if "%1"=="/hu" (set "hu=on" &shift)
- if "%1"=="/ht" (set "ht=on" &shift)
- if "%1"=="/ch" (set "ch=on" &shift)
- if "%1"=="/u" ((for /f "tokens=1-2 delims=@" %%a in ('echo %~2') do (set "user=%%a"& set "server=%%b")) &shift&shift)
- if "%1"=="/p" (set "pass=%~2" &shift&shift)
- if "%1"=="/t" (set "to=%~2" &shift&shift)
- if "%1"=="/s" (set "subject=%~2" &shift&shift)
- if "%1"=="/c" (set "content=%~2" &shift&shift)
- if "%1"=="/a" (set "accessories=%~2" &shift&shift)
- if not "%1"=="" (echo %~1|findstr "^/" >nul 2>nul ||(echo no,参数"%~1"错误&goto :sleep_))
- if !n!==10 (echo no,参数"%~1"错误&goto :sleep_)
- if not "%1"=="" (goto loop_ap)
- )
- set/p=ok<nul&echo.
-
- set/p=分析必须参数是否缺失...<nul
- for %%? in (user server to subject) do (if not defined %%? (echo no&goto :sleep_))
- set/p=ok<nul&echo.
- if not defined pass (
- :inputpass
- for /f "tokens=1 delims=:" %%? in ('findstr /N "=Hiddenpass.cmd_s=" "%oneself%"') do (more +%%? %oneself%>"%temp%\a")
- for /f "tokens=1 delims=:" %%? in ('findstr /N "=Hiddenpass.cmd_e=" "%oneself%"') do (set/a "a=%%?-1" & more +!a! %oneself%>"%temp%\b")
- findstr /V /B /E /G:"%temp%\b" "%temp%\a">"%temp%\pass.cmd"
- start /wait cmd /k ""%temp%\pass.cmd" "!user!@!server!""
- set/p password=<%temp%\pass
- set "pass=!password:~9!"
- if not defined pass goto inputpass
- del /f/q "%temp%\pass" >nul 2>nul
- del /f/q "%temp%\pass.cmd" >nul 2>nul
- del /f/q "%temp%\a" >nul 2>nul
- del /f/q "%temp%\b" >nul 2>nul
- )
-
- set/p=验证支持这个地址的邮箱发信否...<nul
- for /f "tokens=3-6 delims=," %%a in ('findstr "^::,%server%," "%oneself%"') do (
- set "smtp=%%a"&set "port=%%b"&set "认证方式=%%c"&set "max_z=%%d"
- )
- if not defined smtp (echo no&goto :sleep_)
- set/p=ok<nul&echo.
-
- set/p=验证网络通否...<nul
- for /f "tokens=2 delims=[]" %%? in ('ping -n 1 %smtp% ^|findstr /i "^ping.*[.*]"') do (set "ip=%%?")
- if not defined ip (echo no&goto :sleep_)
- set/p=ok<nul&echo.
-
- set/p=验证telnet %smtp% %port%通否...<nul
- >"%temp%\l%t_%" echo quit
- nc -d -nvv %ip% %port% < "%temp%\l%t_%" >"%temp%\p-mailsend.log"
- findstr . "%temp%\p-mailsend.log">nul 2>nul||(echo no&goto :sleep_)
- set/p=ok<nul&echo.
-
- set/p=验证登陆成功否...<nul
- if "%认证方式%"=="1" call :认证方式1
- copy "%temp%\%t_%" "%temp%\l%t_%">nul 2>nul
- >>"%temp%\l%t_%" echo quit
- nc -d -nvv %ip% %port% < "%temp%\l%t_%" >"%temp%\p-mailsend.log"
- set n=0
- for /f "tokens=1,2* delims=:" %%a in ('findstr /N . "%temp%\p-mailsend.log"') do (set "n=%%a"&set "x%%a=%%b")
- set/a n-=1
- echo "!x%n%!"|findstr "235 " >nul 2>nul ||(echo no,错误"!x%n%!"&goto :sleep_)
- set/p=ok<nul&echo.
-
- ::继续写nc配置文件
- >>"%temp%\%t_%" echo mail from: ^<%user%@%server%^>
- if exist "%to%" (
- for /f "tokens=*" %%? in ('findstr "^[0-9a-zA-Z-_.]@" "!to!"') do (set "lto=%%?,!lto!")
- )
- if defined lto (set "to=!lto!")
- for %%? in (!to!) do (>>"%temp%\%t_%" echo rcpt to: ^<%%?^>)
- >>"%temp%\%t_%" echo data
- if not defined hu (>>"%temp%\%t_%" echo From: %user%@%server%) else (>>"%temp%\%t_%" echo From: %匿名%)
- if not defined ht (>>"%temp%\%t_%" echo To: %to%)
- >>"%temp%\%t_%" echo Subject: %subject%
- >>"%temp%\%t_%" echo X-mailer: p-mailsend_v4.0 [cn]
- >>"%temp%\%t_%" echo Mime-Version: 1.0
- >>"%temp%\%t_%" echo Content-Type: multipart/mixed;
- >>"%temp%\%t_%" echo boundary="=====vkill====="
- >>"%temp%\%t_%" echo.
- >>"%temp%\%t_%" echo --=====vkill=====
- if defined content call :htmlortxt !content!
- >>"%temp%\%t_%" echo charset="gb2312"
- >>"%temp%\%t_%" echo Content-Transfer-Encoding: 7bit
- >>"%temp%\%t_%" echo.
- if defined content (dir !content! >nul 2>nul &&(type "!content!">>"%temp%\%t_%" &>>"%temp%\%t_%" echo.) ||(>>"%temp%\%t_%" echo !content!)) else (>>"%temp%\%t_%" echo :^))
-
- set z=0
- if defined accessories set/p=压缩编码附件中...<nul
- echo "%accessories%" |findstr ")" >nul 2>nul && (echo no,附件路径或文件名中不能包含^)&goto :sleep_)
- if defined accessories (
- for /f "tokens=1,2,3,4,5,6 delims=→" %%a in ('echo %accessories%') do (
- call :压缩编码附件 "%%~a"
- call :压缩编码附件 "%%~b"
- call :压缩编码附件 "%%~c"
- call :压缩编码附件 "%%~d"
- call :压缩编码附件 "%%~e"
- call :压缩编码附件 "%%~f" )
- )
- if defined xx (echo no,压缩或编码附件错误&goto :sleep_)
- if not !z! lss %max_z% (echo 附件过大,%server%邮箱最大支持附件大小为%max_z%K&goto :sleep_)
- if defined accessories (set/p=ok<nul&echo.)
- >>"%temp%\%t_%" echo --=====vkill=====--
- >>"%temp%\%t_%" echo .
- >>"%temp%\%t_%" echo quit
-
- ::发信
- set/p=发信中...<nul
- nc -d -nvv %ip% %port% < ""%temp%\%t_%"" >"%temp%\p-mailsend.log"
- for /f "tokens=*" %%? in ("%temp%\p-mailsend.log") do (
- if defined vk1 if not defined vk2 (set vk2=0&set "发信错误=%%?"&echo "%%?"|findstr "250 " >nul 2>nul ||(set vk3=0))
- echo "%%?"|findstr "354 " >nul 2>nul &&(set vk1=0)
- )
- if defined vk3 (echo no,错误"!发信错误!"&goto :sleep_)
- set/p=ok<nul&echo.
-
- call :del_
- echo _________________________________________________
- echo 信件发送完成,2秒后退出
- ping -n 2 127.1 >nul 2>nul
- goto :eof
-
- ::all call::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- :help
- echo.
- echo p-mailsend_v4.0 2007.11 by:vkill Thanks to bjsh,est,lxmxm...
- echo Copyright (C) 2006-2008 http://www.vkill.net http://bbs.cn-dos.net
- echo 当前支持的邮箱有:21cn.com,sina.com,163.com,126.com,sohu.com,yahoo.com.cn,qq.com
- echo 程序依赖文件:nc.exe;rar.exe;base64.exe
- echo 如依赖文件不全请手动到http://www.vkill.net/tools.html上下载到windows目录
- echo.
- echo Usage:
- echo p-mailsend [/hu] [/ht] /u 用户@地址 [/p 密码] /t 收件人 /s 主题 [/c 内容] [/ch] [/a 附件]
- echo.
- echo /hu 匿名发信
- echo /ht 隐藏多方发送时别的收件人
- echo /u * 用户名@地址 例:/u 122755990@qq.com
- echo /p 密码
- echo /t * 收件人:(收件人/写好收件人列表的文本文件路径)
- echo (多收件人用,隔开;用""引住) 例:/t "abc@163.com,123@56.com"
- echo (收件人列表的文本文件格式如下:)
- echo a@163.com
- echo b@163.com
- echo c@163.com
- echo /s * 主题
- echo /c 内容:(文字/写好内容的文本文件路径)
- echo /ch 信件内容html格式开关,表示发送的内容为html格式
- echo /a 附件:(绝对/相对路径,多附件用→隔开用""引住) 例:/a "c:\a b.cmd→1234.txt"
- goto :eof
-
- :认证方式1
- >>"%temp%\%t_%" echo helo vkill
- >>"%temp%\%t_%" echo auth login
- for %%? in (%user%;%pass%) do (
- set/p=%%?^<nul|base64>"l!t_!"
- set/p v=<"l!t_!"
- >>"%temp%\%t_%" echo !v!
- del /f/q "l!t_!"
- )
- goto :eof
-
- :del_
- del /f/q "%temp%\%t_%">nul 2>nul
- del /f/q "%temp%\l%t_%">nul 2>nul
- del /f/q "%temp%\p-mailsend.log">nul 2>nul
- goto :eof
-
- :htmlortxt
- if "%ch%"=="on" (>>"%temp%\%t_%" echo Content-Type: text/html;) else (>>"%temp%\%t_%" echo Content-Type: text/plain;)
- goto :eof
-
- :压缩编码附件
- if "%~1"=="" exit/b
- if "%~x1"==".rar" (copy "%~1" "%temp%\%~n1_.rar" >nul 2>nul) else (
- dir %~1 >nul 2>nul &&(rar.exe -r a "%temp%\%~n1_.rar" "%~1" >nul 2>nul)||(rar.exe a "%temp%\%~n1_.rar" "%~1" >nul 2>nul)
- )
- if not exist "%temp%\%~n1_.rar" (set xx=vkill&exit/b)
- for %%? in ("%temp%\%~n1_.rar") do (set/a z=z+%%~z?)
- >>"%temp%\%t_%" echo --=====vkill=====
- >>"%temp%\%t_%" echo Content-Type: application/octet-stream;
- >>"%temp%\%t_%" echo name="%~n1_.rar"
- >>"%temp%\%t_%" echo Content-Transfer-Encoding: base64
- >>"%temp%\%t_%" echo Content-Disposition: attachment;
- >>"%temp%\%t_%" echo filename="%~n1_.rar"
- >>"%temp%\%t_%" echo.
- base64.exe -i "%temp%\%~n1_.rar">>"%temp%\%t_%"
- >>"%temp%\%t_%" echo.
- del /f/q "%temp%\%~n1_.rar" >nul 2>nul
- goto :eof
-
- :sleep_
- call :del_
- ping -n 2 127.1 >nul 2>nul
- goto :eof
-
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- =Hiddenpass.cmd_s=
- @echo off
- chcp 437>nul&graftabl 936>nul
- echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5x>in.com
- echo (注:输入密码时不明文显示)
- set /p password=请输入mail:%~1的密码:<nul
- for /f "tokens=*" %%i in ('in.com') do set password=%%i
- del in.com
- echo.
- >%temp%\pass set password
- exit
- =Hiddenpass.cmd_e=
-
- :::::::::::::::::::::当前支持的地址::::::::::::::::::::::
- ::,邮箱地址,smtp地址,telnet smtp端口,认证方式,最大附件大小(k)
- ::,21cn.com,smtp.21cn.com,25,1,15000000
- ::,sina.com,smtp.sina.com.cn,25,1,15000000
- ::,163.com,smtp.163.com,25,1,20000000
- ::,126.com,smtp.126.com,25,1,20000000
- ::,sohu.com,smtp.sohu.com,25,1,10000000
- ::,yahoo.com.cn,smtp.mail.yahoo.com,25,1,15000000
- ::,yahoo.com,smtp.mail.yahoo.com,25,1,15000000
- ::,qq.com,smtp.qq.com,25,1,5000000
- ::
复制代码
群发方法:
p-mailsend /u *@* /p * /t a.txt /s test /c * /a *
a.txt格式如下:
a@163.com
b@qq.com
c@56.com
d@yahoo.com.cn
....
本地下载:
http://pan.baidu.com/share/link?shareid=3811808911&uk=1124163200
转自:http://www.cn-dos.net/forum/viewthread.php?tid=29873 |