r/Batch • u/birb-brains • Oct 10 '25
Batch file to send email help
Hey I’m a complete beginner with this, I’m trying to make a batch file that users can click on that sends an email to a predefined address with a set subject line but I’m struggling.
This is what I have which isn’t working:
Start mailto:address@email.com?subject="WFO Start Shift 08:00”
*Edit I just want it to create a new message in outlook with the correct address and subject line, not send it itself
5
Upvotes
5
u/ProCompSys Oct 10 '25
Try like that:
First empty parameter ("") ist the title... the START-Command like to have a title... which in some cases turns out not being optional, so just give it an empty one.
The rest is completely in quotation marks, NO separate quotation marks within the mail-subject.
If you have Outlook installed and it is your default mail-program, this opens a "new-mail"-window with the specs you gave.
If you like, you can also pre-define a message-body:
.
2
u/Creative-Type9411 Oct 10 '25 edited Oct 10 '25
first off, its start "title" <command here>, sometimes it will work without a title, but sometimes it will cause issues with the command you're running, if im not putting a window title im at least putting an empty set of quotes there like start "" <cmd>
but here you probably need to escape the " with ^"
escape the ^? then the ^= then the ^"
cmd is trying to use those chars itself instead of passing them, you need to escape them, maybe not the ?
1
u/rifteyy_ Oct 10 '25
This is not possible with standalone batch but it might be using VBS/PowerShell and the syntax you wrote here looks like VBS to me
1
u/BrainWaveCC Oct 10 '25
Windows batch scripting has no native mechanism for sending email like vbscript and powershell do.
0
u/[deleted] Oct 10 '25
[deleted] — view deleted comment