JSI Tip 8454. How can I change the BLAT sender in a script?

BLAT.EXE is the public domain SMTP command-line mailer.

If you wish to change the Sender for a specific script, simply include lines similar to:

set [email protected]
reg add "HKLM\SOFTWARE\Public Domain\Blat" /v Sender /f /d %nSender%

Where REG.EXE is built into Windows XP and greater, or is installed from the Windows 2000 Support / Tools on the operating system CD-ROM.

NOTE: DO NOT forget to reset the original Sender at the end of your script. To retrieve the original Sender at the beginning of your script:

for /f "Tokens=2*" %%r in ('reg QUERY "HKLM\SOFTWARE\Public Domain\Blat" /v Sender^|Find "REG_SZ"') do (
 set oSender=%%s

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.