Sign in to follow this  
Followers 0
AzKay

Return IP address?

10 posts in this topic

Im making a report system, so, it sends the message to my email, and logs there ip, example

"message" & @cr & @ipaddress1 But, I tested it, and its just logging the routers ip. Is there another way?


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites



Im making a report system, so, it sends the message to my email, and logs there ip, example

"message" & @cr & @ipaddress1 But, I tested it, and its just logging the routers ip. Is there another way?

You'd think by now you would know to provide a working concept of what your trying to do :D Seems I say that every 4th thread of yours.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Search the forum for IP and/or php and/or router and/or outside address. A lot has been written already, including a php script to put on your web host for your own outside IP retriever...


...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

Hehe.

#include <GUIConstants.au3>
#include <smtp.au3>
#NoTrayIcon
Opt("GUIOnEventMode", 1)
### Koda GUI section start ###
$Form1 = GUICreate("Report", 234, 359, 193, 126)
$Combo1 = GUICtrlCreateCombo("Subject", 0, 0, 233, 21)
GUICtrlSetData($Combo1,"General Question|Account Problem|Report Bug|Report Player|Report GM|Other","")
$Edit = GUICtrlCreateEdit("", 0, 96, 233, 233, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
$Input1 = GUICtrlCreateInput("Your Name Here", 0, 24, 233, 21)
$Input2 = GUICtrlCreateInput("Your Email Here", 0, 48, 233, 21)
$Input3 = GUICtrlCreateInput("ScreenShot Here ( Optional )", 0, 72, 233, 21)
$Label1 = GUICtrlCreateLabel("Click To Send", 8, 336, 215, 17, $SS_CENTER)
GUICtrlSetOnEvent($Label1, "_Send")
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUISetState(@SW_SHOW)
### Koda GUI section end   ###

While 1
Local $read = GUICtrlRead($Combo1)
    Sleep(100)
WEnd
    
Func _Send()
If $read = "Subject" Then
    MsgBox(0, "", "Enter A Subject.")
EndIf

If $read = "General Question" Then
    GUICtrlSetData($Label1, "Sending")
    _INetSmtpMailCom("smtp.gmail.com", GUICtrlRead($Input1), "", "ashwing.league@gmail.com", "General Question", GUICtrlRead($Edit) & @cr & @cr & @cr & GUICtrlRead($input2) & @cr & @IPAddress1, GUICtrlRead($Input3), "", "", "smtp.ashwing@gmail.com", "password", 465, 1)
    MsgBox(0, "", "Report Sent, Your Case Will Be Reviewed Shortly.")
    GUICtrlSetData($Label1, "Click To Send")
EndIf

If $read = "Account Problem" Then
    GUICtrlSetData($Label1, "Sending")
    _INetSmtpMailCom("smtp.gmail.com", GUICtrlRead($Input1), "", "ashwing.league@gmail.com", "Account Problem", GUICtrlRead($Edit) & @cr & @cr & @cr & GUICtrlRead($input2) & @cr & @IPAddress1, GUICtrlRead($Input3), "", "", "smtp.ashwing@gmail.com", "password", 465, 1)
    MsgBox(0, "", "Report Sent, Your Case Will Be Reviewed Shortly.")
    GUICtrlSetData($Label1, "Click To Send")
EndIf

If $read = "Report Bug" Then
    GUICtrlSetData($Label1, "Sending")
    _INetSmtpMailCom("smtp.gmail.com", GUICtrlRead($Input1), "", "ashwing.league@gmail.com",  "Report Bug", GUICtrlRead($Edit) & @cr & @cr & @cr & GUICtrlRead($input2) & @cr & @IPAddress1, GUICtrlRead($Input3), "", "", "smtp.ashwing@gmail.com", "password", 465, 1)
    MsgBox(0, "", "Report Sent, Your Case Will Be Reviewed Shortly.")
    GUICtrlSetData($Label1, "Click To Send")
EndIf

If $read = "Report Player" Then
    GUICtrlSetData($Label1, "Sending")
    _INetSmtpMailCom("smtp.gmail.com", GUICtrlRead($Input1), "", "ashwing.league@gmail.com", "Report Player", GUICtrlRead($Edit) & @cr & @cr & @cr & GUICtrlRead($input2) & @cr & @IPAddress1, GUICtrlRead($Input3), "", "", "smtp.ashwing@gmail.com", "password", 465, 1)
    MsgBox(0, "", "Report Sent, Your Case Will Be Reviewed Shortly.")
    GUICtrlSetData($Label1, "Click To Send")
EndIf

If $read = "Report GM" Then
    GUICtrlSetData($Label1, "Sending")
    _INetSmtpMailCom("smtp.gmail.com", GUICtrlRead($Input1), "", "admin@ashwingro.tk", "Report GM", GUICtrlRead($Edit) & @cr & @cr & @cr & GUICtrlRead($input2) & @cr & @IPAddress1, GUICtrlRead($Input3), "", "", "smtp.ashwing@gmail.com", "password", 465, 1)
    MsgBox(0, "", "Report Sent, Your Case Will Be Reviewed Shortly.")
    GUICtrlSetData($Label1, "Click To Send")
EndIf

If $read = "Other" Then
    GUICtrlSetData($Label1, "Sending")
    _INetSmtpMailCom("smtp.gmail.com", GUICtrlRead($Input1), "", "ashwing.league@gmail.com", "Other", GUICtrlRead($Edit) & @cr & @cr & @cr & GUICtrlRead($input2) & @cr & @IPAddress1, GUICtrlRead($Input3), "", "", "smtp.ashwing@gmail.com", "password", 465, 1)
    MsgBox(0, "", "Report Sent, Your Case Will Be Reviewed Shortly.")
    GUICtrlSetData($Label1, "Click To Send")
EndIf
EndFunc

Func Quit()
    Exit
EndFunc

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I seriously don't know wher your going with this, the $read = GUICtrlRead($combo1) in the loop makes no sense to me when your changing it in the _Send()... but whatever... I also don't have smtp.au3 so had to find the function, but shortened yours.

#include <GUIConstants.au3>
#include <Inet.au3>
#NoTrayIcon
Global $CurrentIP = _GetIP()
Global $aText = StringSplit('General Question,Account Problem,Report Bug,Report Player,Report GM,Other', ',', 1)
Global $aEmail = StringSplit('ashwing.league@gmail.com,ashwing.league@gmail.com,ashwing.league@gmail.com,' &  _
        'ashwing.league@gmail.com,admin@ashwingro.tk,ashwing.league@gmail.com', ',', 1)
Opt("GUIOnEventMode", 1)
;### Koda GUI section start ###
$Form1 = GUICreate("Report", 234, 359, 193, 126)
$Combo1 = GUICtrlCreateCombo("Subject", 0, 0, 233, 21)
GUICtrlSetData($Combo1,"General Question|Account Problem|Report Bug|Report Player|Report GM|Other","")
$Edit = GUICtrlCreateEdit("", 0, 96, 233, 233, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
$Input1 = GUICtrlCreateInput("Your Name Here", 0, 24, 233, 21)
$Input2 = GUICtrlCreateInput("Your Email Here", 0, 48, 233, 21)
$Input3 = GUICtrlCreateInput("ScreenShot Here ( Optional )", 0, 72, 233, 21)
$Label1 = GUICtrlCreateLabel("Click To Send", 8, 336, 215, 17, $SS_CENTER)
GUICtrlSetOnEvent($Label1, "_Send")
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUISetState(@SW_SHOW)
;### Koda GUI section end   ###
While 1
    Sleep(100)
WEnd

Func _Send()
    Local $read = GUICtrlRead($Combo1)
    If $read = "Subject" Then
        MsgBox(0, "", "Enter A Subject.")
    EndIf
    For $iCount = 1 To UBound($aText) - 1
        If $read = $aText[$iCount] Then
            GUICtrlSetData($Label1, "Sending")
            _INetSmtpMailCom("smtp.gmail.com", GUICtrlRead($Input1), "",  _
                    "ashwing.league@gmail.com", $aText[$iCount],  _
                    GUICtrlRead($Edit) & @CR & @CR & @CR & GUICtrlRead($Input2) & @CR & $CurrentIP,  _
                    GUICtrlRead($Input3), "", "", $aEmail[$iCount], "password", 465, 1)
            MsgBox(0, "", "Report Sent, Your Case Will Be Reviewed Shortly.")
            GUICtrlSetData($Label1, "Click To Send")
        EndIf
    Next
EndFunc   ;==>_Send

Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "",$IPPort=25, $ssl=0)
    $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Cc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body,"<") And StringInStr($as_Body,">") Then
        $objEmail.HTMLBody = $as_Body
    Else
        $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
        Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
        For $x = 1 To $S_Files2Attach[0]
            $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
            If FileExists($S_Files2Attach[$x]) Then
                $objEmail.AddAttachment ($S_Files2Attach[$x])
            Else
                $i_Error_desciption = $i_Error_desciption & @LF & 'File not found to attach: ' & $S_Files2Attach[$x]
                SetError(1)
                Return 0
            EndIf
        Next
    EndIf
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
    ;Authenticated SMTP
    If $s_Username <> "" Then
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
    If $ssl Then
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    EndIf
    ;Update settings
    $objEmail.Configuration.Fields.Update
    ; Sent the Message
    $objEmail.Send
    If @error Then
        SetError(2)
        Return $oMyRet[1]
    EndIf
EndFunc   ;==>_INetSmtpMailCom
;
;
; Com Error Handler
Func MyErrFunc()
    $HexNumber = Hex($oMyError.number, 8)
    $oMyRet[0] = $HexNumber
    $oMyRet[1] = StringStripWS($oMyError.description,3)
    ConsoleWrite("### COM Error !  Number: " & $HexNumber & "   ScriptLine: " & $oMyError.scriptline & "   Description:" & $oMyRet[1] & @LF)
    SetError(1); something to check for when this function returns
    Return
EndFunc   ;==>MyErrFunc
Func Quit()
    Exit
EndFunc   ;==>Quit

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

All im needing to know, is how to send the ip of the sender.

It functions fine. everything works fine, the only problem is, it sends me the ip of my router, but I dont want the routers ip.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

All im needing to know, is how to send the ip of the sender.

It functions fine. everything works fine, the only problem is, it sends me the ip of my router, but I dont want the routers ip.

Geeze, does anyone freaking read anything anymore... TEST THE FREAKING SCRIPT!

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

All fixed now. I was unaware that there was _GetIP()


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

and the $read was in a loop, so its constantly checking it, orelse it just says to choose a subject.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

and the $read was in a loop, so its constantly checking it, orelse it just says to choose a subject.

It doesn't need to be in the loop:
#include <GUIConstants.au3>
#include <Inet.au3>
#NoTrayIcon
Global $CurrentIP = _GetIP()
Global $aText = StringSplit('General Question,Account Problem,Report Bug,Report Player,Report GM,Other', ',', 1)
Global $aEmail = StringSplit('ashwing.league@gmail.com,ashwing.league@gmail.com,ashwing.league@gmail.com,' &  _
        'ashwing.league@gmail.com,admin@ashwingro.tk,ashwing.league@gmail.com', ',', 1)
Opt("GUIOnEventMode", 1)
;### Koda GUI section start ###
$Form1 = GUICreate("Report", 234, 359, 193, 126)
$Combo1 = GUICtrlCreateCombo("Subject", 0, 0, 233, 21)
GUICtrlSetData($Combo1,"General Question|Account Problem|Report Bug|Report Player|Report GM|Other","")
$Edit = GUICtrlCreateEdit("", 0, 96, 233, 233, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
$Input1 = GUICtrlCreateInput("Your Name Here", 0, 24, 233, 21)
$Input2 = GUICtrlCreateInput("Your Email Here", 0, 48, 233, 21)
$Input3 = GUICtrlCreateInput("ScreenShot Here ( Optional )", 0, 72, 233, 21)
$Label1 = GUICtrlCreateLabel("Click To Send", 8, 336, 215, 17, $SS_CENTER)
GUICtrlSetOnEvent($Label1, "_Send")
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUISetState(@SW_SHOW)
;### Koda GUI section end   ###
While 1
    Sleep(100)
WEnd

Func _Send()
    Local $read = GUICtrlRead($Combo1)
    If $read = "Subject" Then
        MsgBox(0, "", "Enter A Subject.")
        Return SetError(1, 0, 0)
    EndIf
    For $iCount = 1 To UBound($aText) - 1
        If $read = $aText[$iCount] Then
            GUICtrlSetData($Label1, "Sending")
            _INetSmtpMailCom("smtp.gmail.com", GUICtrlRead($Input1), "",  _
                    "ashwing.league@gmail.com", $aText[$iCount],  _
                    GUICtrlRead($Edit) & @CR & @CR & @CR & GUICtrlRead($Input2) & @CR & $CurrentIP,  _
                    GUICtrlRead($Input3), "", "", $aEmail[$iCount], "password", 465, 1)
            MsgBox(0, "", "Report Sent, Your Case Will Be Reviewed Shortly.")
            GUICtrlSetData($Label1, "Click To Send")
        EndIf
    Next
EndFunc   ;==>_Send

Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "",$IPPort=25, $ssl=0)
    $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Cc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body,"<") And StringInStr($as_Body,">") Then
        $objEmail.HTMLBody = $as_Body
    Else
        $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
        Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
        For $x = 1 To $S_Files2Attach[0]
            $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
            If FileExists($S_Files2Attach[$x]) Then
                $objEmail.AddAttachment ($S_Files2Attach[$x])
            Else
                $i_Error_desciption = $i_Error_desciption & @LF & 'File not found to attach: ' & $S_Files2Attach[$x]
                SetError(1)
                Return 0
            EndIf
        Next
    EndIf
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
    ;Authenticated SMTP
    If $s_Username <> "" Then
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
    If $ssl Then
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    EndIf
    ;Update settings
    $objEmail.Configuration.Fields.Update
    ; Sent the Message
    $objEmail.Send
    If @error Then
        SetError(2)
        Return $oMyRet[1]
    EndIf
EndFunc   ;==>_INetSmtpMailCom
;
;
; Com Error Handler
Func MyErrFunc()
    $HexNumber = Hex($oMyError.number, 8)
    $oMyRet[0] = $HexNumber
    $oMyRet[1] = StringStripWS($oMyError.description,3)
    ConsoleWrite("### COM Error !  Number: " & $HexNumber & "   ScriptLine: " & $oMyError.scriptline & "   Description:" & $oMyRet[1] & @LF)
    SetError(1); something to check for when this function returns
    Return
EndFunc   ;==>MyErrFunc
Func Quit()
    Exit
EndFunc   ;==>Quit
Look at the Return that's done after the MsgBox() makes sure the rest of the function isn't carried out.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0