Jump to content

Recommended Posts

Posted

I noticed that you had to specify an SMTP server for the function that comes with Autoit (_INetSmtpMail), so I made a quick function to find the Mail Exchange for a given domain. Should work most of the time for finding a valid SMTP server for an email address:

MsgBox(0,"",GetMX("Irongeek.com"))



Func GetMX($SomeDomain)
$cmdpid = Run(@comspec & " /C nslookup -querytype=mx " & $SomeDomain, @SystemDir, @SW_HIDE,  2) 
$line = StdoutRead($cmdpid)
$f=StringInStr($line, "mail exchanger =")+16
$i=0
$l=0
while $l < $f 
        $l=StringInStr($line, @CR, 0, $i)
        $i=$i+1
WEnd
return StringMid($line, $f, $l-$f)
EndFunc

I'm use to being able to give InStr a starting point, not an occurance number. Is there a better way?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...