以下为代码
@echo off
color f0
title 邮箱发信器
mode con cols=80 lines=26
:email
cls
echo.┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
echo.┃ ┏━━━━━━━━━━━┓ ┏━━━━━━━━━━━┓┃
echo.┃收信人邮箱┃ ┃SMTP服务器┃ ┃┃
echo.┃ ┗━━━━━━━━━━━┛ ┗━━━━━━━━━━━┛┃
echo.┃ ┏━━━━━━━━━━━┓ ┏━━━━━━━━━━━┓┃
echo.┃发信人邮箱┃ ┃发信人密码┃ ┃┃
echo.┃ ┗━━━━━━━━━━━┛ ┗━━━━━━━━━━━┛┃
echo.┃ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓┃
echo.┃邮件的标题┃ ┃┃
echo.┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛┃
echo.┃┏邮件内容━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓┃
echo.┃┃ ┃┃
echo.┃┃ ┃┃
echo.┃┃ ┃┃
echo.┃┃ ┃┃
echo.┃┃ ┃┃
echo.┃┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛┃
echo.┃ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃
echo.┃附件的路径┃ ┃ ┃
echo.┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┃
echo.┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
echo.┏━━━━┓ ┏━━━━━━━━┓ ┏━━━━┓
echo.┃ 重设 ┃ ┃ 发送邮件 ┃ ┃ 退出 ┃
echo.┗━━━━┛ ┗━━━━━━━━┛ ┗━━━━┛
curs /pos 14 2
set /p To=
ping /n 1 127.1 >nul
curs /pos 50 2
set /p Smtp=
curs /pos 14 5
set /p From=
curs /pos 50 5
set /p Pass=
curs /pos 14 8
set /p Subject=
curs /pos 4 11
set /p Textbody=
curs /pos 14 18
set /p Attachment=
cmos 0 -1 1
for /l %%i in (2,1,12) do (if %errorlevel%==%%i023 goto email)
for /l %%i in (30,1,48) do (if %errorlevel%==%%i023 call:email.vbs)
for /l %%i in (65,1,75) do (if %errorlevel%==%%i023 del email.vbs&exit)
goto email
:email.vbs
echo On Error Resume Next >email.vbs
echo NameSpace = "
http://schemas.microsoft.com/cdo/configuration/" >>email.vbs
echo Set Email = CreateObject("CDO.Message") >>email.vbs
echo Dim EmlUser() >>email.vbs
echo EmlUser = Split(%User%, "@") >>email.vbs
echo Email.From = "%From%" >>email.vbs
echo Email.To = "%To%" >>email.vbs
echo Email.Subject = "%Subject%" >>email.vbs
echo Email.AddAttachment "%Attachment%" >>email.vbs
echo Email.Textbody = "%Textbody%" >>email.vbs
echo With Email.Configuration.Fields >>email.vbs
echo .Item(NameSpace^&"sendusing") = 2 >>email.vbs
echo .Item(NameSpace^&"smtpserver") = "%Smtp%" >>email.vbs
echo .Item(NameSpace^&"smtpserverport") = 25 >>email.vbs
echo .Item(NameSpace^&"smtpauthenticate") = 1 >>email.vbs
echo .Item(NameSpace^&"sendusername") = EmlUser(1) >>email.vbs
echo .Item(NameSpace^&"sendpassword") = "%Pass%" >>email.vbs
echo .Update >>email.vbs
echo End With >>email.vbs
echo Err.clear >>email.vbs
echo Email.Send >>email.vbs
echo If Err.number^<^>0 Then >>email.vbs
echo SendMail=False >>email.vbs
echo msgbox "发送失败" >>email.vbs
echo Else >>email.vbs
echo SendMail=True >>email.vbs
echo msgbox "发送成功" >>email.vbs
echo End If >>email.vbs
echo Set Email=Nothing >>email.vbs
start email.vbs
goto :eof