Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setLocal EnableDelayedExpansion
- :start
- set /p sign1=<username.txt
- if not "%sign1%" =="" (goto signedin)
- :start2
- echo.>error.txt
- echo.>username.txt
- echo.>pass.txt
- echo.>body.txt
- set var1="@gmail.com"
- set username=
- set /P username=Enter your Gmail account username : %=%
- If NOT "%username%"=="%username:@gmail.com=%" (
- goto next
- ) else (
- goto wrong
- )
- pause
- :next
- cls
- echo %username%>username.txt
- Call :PasswordInput "Enter your Gmail account password"
- :maskdone
- echo %password%>pass.txt
- Powershell.exe -executionpolicy remotesigned -File "%CD%\check.ps1"
- set /p error=<error.txt
- if "%error%" == "1" (goto wrong)
- cls
- :fromsignedin
- set recp=
- set /P recp=Enter the e-mail address of the recipient : %=%
- cls
- set subject=
- set /P subject=Enter the subject of your e-mail : %=%
- cls
- :attach
- echo Do you wish to add an attachment?
- echo.
- echo File extensions such as .exe, .zip, .7z, .rar... are unavailable.
- echo Consult "https://support.google.com/mail/answer/6590?hl=en" for more info.
- set attach=
- set /P attach=Input "1" for YES, "2" for NO : %=%
- if "%attach%" == "1" (goto loop)
- if "%attach%" == "2" (goto bodycontents)
- cls
- echo Invalid input.
- goto attach
- :loop
- set "tempfile=%temp%\file-%random%"
- if exist "%tempfile%" goto :loop
- call :getfile "c:\"
- for /f "delims=" %%a in ('powershell "%tempfile%.ps1" ') do (
- set "filepath=%%~dpa"
- set "filename=%%~nxa"
- set chosenattach=%filepath%%filename%
- :repeatlots
- if not "%chosenattach%" =="" (goto attachnotempty)
- goto attachnotempty
- :attachnotempty
- pause
- del "%tempfile%.ps1"
- :attachrepeat
- cls
- echo You have chosen "%chosenattach%" as your attachment.
- echo Do you wish to continue with this attachment?
- set attachsure=
- set /p attachsure=Input "1" for YES, "2" for NO : %=%
- if "%attachsure%" == "1" (goto bodycontents)
- if "%attachsure%" == "2" (goto attach)
- cls
- echo Invalid input.
- goto attachrepeat
- :getfile
- (
- echo $ErrorActionPreference= 'silentlycontinue'
- echo $initialDirectory = "%~1"
- echo [System.Reflection.Assembly]::LoadWithPartialName^("System.windows.forms"^) ^| Out-Null
- echo $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
- echo $OpenFileDialog.initialDirectory = $initialDirectory
- echo $OpenFileDialog.filter = "All files (*.*)| *.*"
- echo $OpenFileDialog.ShowDialog^(^) ^| Out-Null
- echo $OpenFileDialog.filename
- ) > "%tempfile%.ps1"
- goto :EOF
- :bodycontents
- cls
- echo Enter the contents of your e-mail in the text file.
- echo.>body.txt
- :notdone
- start "" "%cd%\body.txt"
- :notdone2
- cls
- echo.
- echo Please remember to save the file. ("Ctrl" + "S")
- echo Press any key to submit the contents of the email.
- pause>nul
- :repeatconfirm
- set confirm=
- set /P confirm=Are you sure you want to continue? (Input "1" for YES, "2" for NO) : %=%
- if "%confirm%" == "1" (goto continue)
- if "%confirm%" == "2" (goto notdone2)
- cls
- echo Invalid input.
- goto repeatconfirm
- :continue
- taskkill /IM notepad.exe>nul
- :again
- tasklist /FI "IMAGENAME eq notepad.exe" 2>NUL | find /I /N "notepad.exe">NUL
- cls
- echo Waiting for Notepad to close...
- if "%ERRORLEVEL%"=="0" goto again
- cls
- for /f "delims=" %%i in (body.txt) do set "body=!body! %%i"
- echo %recp%>recp.txt
- echo %subject%>subject.txt
- echo %chosenattach%>path.txt
- Powershell.exe -executionpolicy remotesigned -File "%CD%\exp.ps1"
- echo E-Mail Sent.
- ping 1.1.1.1 -n 1 -w 200>nul
- cls
- echo E-Mail Sent.
- goto start
- :wrong
- cls
- echo Invalid username or password.
- goto start
- :PasswordInput
- set "psCommand=powershell -Command "$pword = read-host 'Enter Password' -AsSecureString ; ^
- $BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword); ^
- [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)""
- for /f "usebackq delims=" %%p in (`%psCommand%`) do set password=%%p
- goto maskdone
- :signedin
- echo The account "%sign1%" is logged in.
- echo Would you like to continue with that account?
- set sure=
- set /P sure=Press "1" to continue, "2" to sign out : %=%
- if "%sure%" == "1" (goto ffromsignedin)
- if "%sure%" == "2" (goto sstart2)
- cls
- echo Invalid input.
- goto signedin
- :ffromsignedin
- cls
- goto fromsignedin
- :sstart2
- goto start2
- :attachempty
- cls
- echo Invalid attachment.
- goto loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement