Last active
December 1, 2022 22:42
-
-
Save tomasfejfar/0f73e9b5443960b79e55588b38a9ad31 to your computer and use it in GitHub Desktop.
Windows fake sendmail to save mail to file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
::where do we store the messages | |
SET mailpath=c:\xampp\tmp\mail\ | |
if not exist %mailpath% mkdir %mailpath% | |
::create filename | |
echo %date:~0,11% | |
SET filename=%date:~11,4%-%date:~7,2%-%date:~3,2%_%hours%-%time:~3,2%-%time:~6,2%_%time:~9,2% | |
::make filename unique | |
:random | |
SET file="%mailpath%%filename%--%RANDOM%.mhtml" | |
IF EXIST %file% goto :random | |
::save email to file | |
more %1 > %file% | |
echo "%file%" > c:\temp\list | |
::open email directory with explorer (optional) | |
start %mailpath% | |
::or open email file directly | |
:: start %file% | |
echo "mail sent" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use like this: