Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Obtaining IP address and emailing it

$
0
0
Okay, I'm making some private software and I need the ip address and host name of the computers that run my software, this is because I don't want more people than I have allowed using my software.

This is my current code:
Dim Mail As New MailMessage
        Try
            Mail.Subject = "Cryptts"
            Mail.To.Add("email")
            Mail.From = New MailAddress("email")

            Dim strHostName As String

            Dim strIPAddress As String

            strHostName = System.Net.Dns.GetHostName()

            strIPAddress = System.Net.Dns.GetHostEntry(strHostName).AddressList(0).ToString()

            Mail.Body = "Host name:" & strHostName & vbCrLf & "Host IP:" & strIPAddress

            Dim SMTP As New SmtpClient("mx1.hotmail.com")
            SMTP.EnableSsl = True

            SMTP.Credentials = New System.Net.NetworkCredential("email", "password")

            SMTP.Port = 587

            SMTP.Send(Mail)

        Catch ex As Exception

        End Try


Lets just presume email and password are variables so that you don't see my email and password.
I've followed lots of steps to get the SMTP information, but it would be great if anyone else could confirm that I have them correct? (I'm @live.co.uk). The thing is that the above code takes FOREVER to execute, about 5 minutes, also I'm not receiving the emails. So is there anything wrong with my code? (mail to and mail from are the same). I don't get why it takes so long to execute and why I don't receive the emails. Thanks in advance :)
~Lukee9
Message for more info :) (and yes I have Imports System.Net.Mail)

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>