Skip to content

Instantly share code, notes, and snippets.

@Maslor
Created September 9, 2016 14:12
Show Gist options
  • Save Maslor/27dccbef81021a1b97da01cdddd06dcc to your computer and use it in GitHub Desktop.
Save Maslor/27dccbef81021a1b97da01cdddd06dcc to your computer and use it in GitHub Desktop.
script that sends emails from selected email (any email of your choosing). Replace "mail.server" with the desired mail server and "port" with the required port (usually 25).
<job>
<script language="VBScript">
Option Explicit
On Error Resume Next
Dim WshShell
set WshShell=CreateObject("WScript.Shell")
WshShell.run "cmd.exe"
WScript.Sleep 1000
'Step 1 - Telnet to remote IP'
WshShell.SendKeys "telnet mail.server port(usually 25)"
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
'Step 2 - Issue Commands with pauses'
WshShell.SendKeys ("ehlo mail.server port(usually 25)")
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
Dim origin
origin = InputBox("Enter the email you want to use as the origin:")
WshShell.SendKeys ("mail from: " & origin)
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
Dim destination
destination = InputBox("Enter the recipient of the email:")
WshShell.SendKeys ("rcpt to: " & destination)
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
Dim title
title = InputBox("Enter your email's subject:")
Dim text
text = InputBox("Enter your email's content:")
WshShell.SendKeys ("data")
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
WshShell.SendKeys ("Subject: " & title)
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
WshShell.sendKeys (text)
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
WshShell.SendKeys (".")
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
WshShell.SendKeys ("quit")
WshShell.SendKeys ("{Enter}")
</script>
</job>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment