Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Telnet
#1
Ginataras,

I know you don't know Telnet, but I'm begging for help!

Here's how it starts, find the mail exchanger server:
nslookup -q=mx newstrib.com


No problem getting that to work:
Function MailExchanger
Code:
Copy      Help
RunConsole2(F"nslookup -q=mx newstrib.com" _s)
str MailExchange
str pattern="mail exchanger = (.*?)\r\n"
if(findrx(_s pattern 0 0 MailExchange 1)>=0)
,out MailExchange

Then I Telnet in:
telnet mail.newstrib.com 25

Then I set the mail from:
mail from:[email protected]

Then I test to see if a recipient exist:
rcpt to:[email protected]

If the address exists on the server I will get an OK, if not I will get that it is rejecting.

I need to automate this, but cannot figure out how to execute the telnet portion of this with QuickMacros

Thank you!
#2
How the code would look in some other language, eg C++ or C#?
#3
I don't know. I only know what I run through the Telnet prompt so my thoughts are very bat file.

Could something be done in PowerShell or anything?

I messed around a lot with putty.exe but don't feel like it's helping much.

Tomorrow I'm going to play around with cURL

-cool.
#4
I almost never used telnet, and never used it in programming. Probably need TCP client, eg QM TcpSocket class, and know telnet protocol.
#5
Sometimes I get that telephone wire and touch tones sort of feeling.
#6
http://technet.microsoft.com/en-us/libr ... 91013.aspx
#7
I did figure this out. Problem is that now I am finding that a lot of servers will reply ok even if the user doesn't exist.

VRFY is also disabled on most servers.

and finally, some servers don't seem to recognize RCPT TO:<email> NOTIFY=FAILURE

so here's the script I worked out:
Function TelnetEmail
Code:
Copy      Help
#compile "__TcpIpClient"
TcpIpClient x

str carrier="txt.bell.ca"
str number="5555555555"
str body="HELO WRLD"

RunConsole2(F"nslookup -q=mx {carrier}" _s)
str MailExchange
str pattern="mail exchanger = (.*?)\r\n"
if(findrx(_s pattern 0 0 MailExchange 1)>=0)
,out MailExchange


pattern="mail exchanger = (.*?)\r\n"
str receivedData
if(!x.Connect(MailExchange 25))
,end "failed to connect"

x.Send("HELO HI[]")
x.Send("MAIL FROM:[email protected][]")
x.Send(F"RCPT TO:<{number}@{carrier}>[]")
x.Send(F"DATA[]")
x.Send(F"[]")
x.Send(F"{body}[]")
x.Send(F".[]")
x.SendEnd
x.Receive(receivedData)
out receivedData
x.Close


Forum Jump:


Users browsing this thread: 1 Guest(s)