I was trying to have a Post Logon action type in the command for using TELNET to test a internal SMTP server.
Login to TELNET at port 25 on internal SMTP Server and execute the following commands
EHLO <user@org.org>
MAIL FROM: <user1@org.org>
RCPT TO: <user2@org.com>
DATA
Subject: This is a test
{ENTER}
{ENTER}
This tests our internal relay
{ENTER}
.
{ENTER}
QUIT
I have tried putting {ENTER} after each line even though the setting is toggled to send it automatedly after each line. I set local echo to on. But it just wants to dump the commands and not wait for a response. I have tried inserting {DELAY} but that does not seem to change the behavior.
This seemed like a simple test, but is proving more difficult than I thought. Is there a way to do this with?
Hello,
Thank you for reaching out. I’d like to understand more about how you are launching the SMTP commands in RDM. What type of session are you using?
I currently don’t have an SMTP server available for testing, but from my understanding, RDM’s Post-Logon Command feature executes commands sequentially. However, by default, it does not wait for a response before sending the next command. Since Telnet requires sequential interaction, the best approach would be to use a script-based workaround.
You could try using a PowerShell Script Session in RDM by running the following script:
powershellCopierModifier$SMTPServer = "your.smtp.server"
$Port = 25
$client = New-Object System.Net.Sockets.TcpClient($SMTPServer, $Port)
$stream = $client.GetStream()
$reader = New-Object System.IO.StreamReader($stream)
$writer = New-Object System.IO.StreamWriter($stream)
$writer.AutoFlush = $true
# Function to send command and wait for response
function Send-Command($command) {
$writer.WriteLine($command)
Start-Sleep -Milliseconds 500 # Adjust delay if needed
$response = $reader.ReadLine()
Write-Output $response # Optional: log responses
}
# SMTP Commands
Send-Command "EHLO user@org.org"
Send-Command "MAIL FROM: <user1@org.org>"
Send-Command "RCPT TO: <user2@org.com>"
Send-Command "DATA"
Send-Command "Subject: This is a test`r`n"
Send-Command "This tests our internal relay`r`n."
Send-Command "QUIT"
# Close connection
$reader.Close()
$writer.Close()
$client.Close()
This script will:
Sends commands one at a time, ensuring proper sequential execution. Uses delays (Start-Sleep) to prevent commands from being sent too quickly. Waits for responses before proceeding to the next command.
Let me know if this helps or if you need further clarification.
Best regards,
Michel Audi