Jump to content

Internet Speed check and check provider


Recommended Posts

Hi,

I am trying to create a script wich checks my hardware and my internet information.

The hardware part is done and I got my external IP-check working but I have searched far and wide but not came up wich an example for an internet speed check.

Can any one help me.
Below you will find my script:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Inet.au3>
#include <WinAPIReg.au3>
#include <Security.au3>
#include <WinAPI.au3>
#include "NavInfo.au3"

GUICreate("Mijn Salon - Check", 283, 311, -1, -1)

GUICtrlCreateGroup("Systeem info", 8, 8, 265, 145)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $PROC = GUICtrlCreateInput("", 16, 32, 249, 21)
        $READPROC = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0", "ProcessorNameString")
        GUICtrlSetData($PROC, $READPROC)
        GUICtrlSetState($PROC, $GUI_DISABLE)
    $RAM = GUICtrlCreateInput("RAM", 16, 56, 121, 21)
        Local $aMem = MemGetStats()
            $mem = $aMem[1] /1024
            $mem1= $mem /1024
            $mem2= Round($mem1, 0)
        GUICtrlSetData($RAM, $mem2 & " GB Geheugen")
        GUICtrlSetState($RAM, $GUI_DISABLE)
    $MODEL = GUICtrlCreateInput("", 144, 56, 121, 21)
        $READMODEL1 = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\Bios", "SystemManufacturer")
        $READMODEL2 = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\Bios", "BaseBoardProduct")
        GUICtrlSetData($MODEL, $READMODEL1 & " " & $READMODEL2)
        GUICtrlSetState($MODEL, $GUI_DISABLE)
    $WINDOWS = GUICtrlCreateInput("", 16, 80, 249, 21)
        $READOS = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName")
        If @OSArch = "X86" Then
            $ARCH = "32-Bit"
        Else
            $ARCH = "64-Bit"
        EndIf
        GUICtrlSetData($WINDOWS, $READOS & " " & $ARCH)
        GUICtrlSetState($WINDOWS, $GUI_DISABLE)
    $IE = GUICtrlCreateInput("", 16, 104, 249, 21)
        Local $sVersion = FileGetVersion(@ProgramFilesDir & "\Internet Explorer\iexplore.exe")
        GUICtrlSetData($IE, "Internet Explorer: " & $sVersion)
        GUICtrlSetState($IE, $GUI_DISABLE)
    $SILVERLIGHT = GUICtrlCreateInput("SILVERLIGHT", 16, 128, 249, 21)
        $Silverlight_Version = _NavInfo_GetSilverlightVersion()
            If Not @error Then
                GUICtrlSetData($SILVERLIGHT, "Silverlight: " & $Silverlight_Version)
            EndIf
        GUICtrlSetState($SILVERLIGHT, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)

GUICtrlCreateGroup("Internet info", 8, 160, 265, 113)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $SPEED = GUICtrlCreateInput("SPEED", 16, 184, 249, 21)
    $IPADRES = GUICtrlCreateInput("", 16, 216, 249, 21)
        $PublicIP = _GetIP()
        GUICtrlSetData($IPADRES, $PublicIP)
        GUICtrlSetState($IPADRES, $GUI_DISABLE)
    $PROVIDER = GUICtrlCreateInput("PROVIDER", 16, 248, 249, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$SAVE = GUICtrlCreateButton("Opslaan naar .txt", 8, 280, 131, 25)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$MAIL = GUICtrlCreateButton("Send E-mail", 144, 280, 131, 25)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $SAVE
            SAVE()
        Case $MAIL
            MAIL()
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func SAVE()
    $READIE     = GUICtrlRead($IE)
    $IEDONE     = StringTrimLeft($READIE, 19)
    $READSILVER = GUICtrlRead($SILVERLIGHT)
    $SILVERDONE = StringTrimLeft($READSILVER, 13)

    If FileExists(@Desktopdir & "\check.txt") Then
        FileDelete(@desktopdir & "\check.txt")
    EndIf
    $DEBITNR    = InputBox("Invoeren", "Voer klantnaam in:", "")
    $MEDEWERKER = InputBox("Invoeren", "Uitgevoerd door:", "")
    $FILE       = FileOpen(@desktopdir & "\check.txt", 1)
    $1  = GUICtrlRead($PROC)
    $2  = GUICtrlRead($RAM)
    $3  = GUICtrlRead($MODEL)
    $4  = GUICtrlRead($WINDOWS)
    $5  = $IEDONE
    $6  = $SILVERDONE
    $7  = GUICtrlRead($SPEED)
    $8  = GUICtrlRead($IPADRES)
    $9  = GUICtrlRead($PROVIDER)
        FileWrite($FILE, "Klantnaam:         " & $DEBITNR & @CRLF)
        FileWrite($FILE, "Datum:             " & @MDAY & "-" & @MON & "-" & @YEAR & @CRLF & @CRLF)
        FileWrite($FILE, "Processor:         " & $1 & @CRLF)
        FileWrite($FILE, "Geheugen:          " & $2 & @CRLF)
        FileWrite($FILE, "Model:             " & $3 & @CRLF)
        FileWrite($FILE, "Windows:           " & $4 & @CRLF)
        FileWrite($FILE, "Internet Explorer: " & $5 & @CRLF)
        FileWrite($FILE, "Silverlight:       " & $6 & @CRLF & @CRLF)
        FileWrite($FILE, "Internet Snelheid: " & $7 & @CRLF)
        FileWrite($FILE, "IP-Adres:          " & $8 & @CRLF)
        FileWrite($FILE, "Internet Provider: " & $9 & @CRLF & @CRLF)
        FileWrite($FILE, "Uitgevoerd door:   " & $MEDEWERKER)

MsgBox(4096, "Klaar", "Check is klaar en opgeslagen op het bureaublad")
EndFunc

Func MAIL()

EndFunc

 

Link to comment
Share on other sites

I'm losing hope here...maybe i could use a third party software? Anyone got any ideas for me...

​...just got to read this. Haven't test your code, but, you'll need a place to upload a file to, then calculate how much data per second. or how long it took to upload.
Have faith, or perseverance, or patients, ...my technic is random try. You can code it all with the tools on the site. Don't give up. Do a search maybe you'll find something close to what you envision. 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

the same UDF creator also made https://www.autoitscript.com/forum/topic/149083-netinfo-udf/ that does what you want.
But it has issues, at line 247 you'll need to replace it with If UBound($aRegex) - 1 <> 7 Then Return SetError(1, 0, $aReturn) or at failure point it'll stop the script.

Hope this brings the morale up  =D

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

It gives me some hope but i think i am doing something wrong, i editted the line 247 like you said:

Func _NetInfo_GetIPLocation()
    Local $aReturn[4], $bRead, $sRead, $aRegex
    $bRead = InetRead("http://www.ip-tracker.org/track-ip-api.php")
    $sRead = BinaryToString($bRead)
    $aRegex = StringRegExp($sRead, '<b>(.*?)</b>', 3)
    If UBound($aRegex) - 1 <> 7 Then Return SetError(1, 0, $aReturn)
;   If UBound($aRegex) - 1 <> 7 Then Return SetError(1, 0, "")
    $aReturn[0] = $aRegex[0]
    $aReturn[1] = $aRegex[1]
    $aReturn[2] = $aRegex[4]
    $aReturn[3] = $aRegex[5]

    Return $aReturn
EndFunc   ;==>_NetInfo_GetIPLocation

And i think i added the correct code to the script but i am missing something...

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Inet.au3>
#include <WinAPIReg.au3>
#include <Security.au3>
#include <WinAPI.au3>
#include <NavInfo.au3>
#include <Netinfo.au3>

TrayTip("Mijn Salon - Check", "Bezig met opstarten...", 3)
    Sleep(3000)

GUICreate("Mijn Salon - Check", 283, 311, -1, -1)

GUICtrlCreateGroup("Systeem info", 8, 8, 265, 145)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    TrayTip("Mijn Salon - Check", "Bezig met uitlezen processor informatie...", 3)
        Sleep(1500)
    $PROC = GUICtrlCreateInput("", 16, 32, 249, 21)
        $READPROC = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0", "ProcessorNameString")
        GUICtrlSetData($PROC, $READPROC)
        GUICtrlSetState($PROC, $GUI_DISABLE)
    TrayTip("Mijn Salon - Check", "Bezig met uitlezen geheugen capaciteit...", 3)
        Sleep(1500)
    $RAM = GUICtrlCreateInput("", 16, 56, 121, 21)
        Local $aMem = MemGetStats()
            $mem = $aMem[1] /1024
            $mem1= $mem /1024
            $mem2= Round($mem1, 0)
        GUICtrlSetData($RAM, $mem2 & " GB Geheugen")
        GUICtrlSetState($RAM, $GUI_DISABLE)
    TrayTip("Mijn Salon - Check", "Bezig met uitlezen model informatie...", 3)
        Sleep(1500)
    $MODEL = GUICtrlCreateInput("", 144, 56, 121, 21)
        $READMODEL1 = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\Bios", "SystemManufacturer")
        $READMODEL2 = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\Bios", "BaseBoardProduct")
        GUICtrlSetData($MODEL, $READMODEL1 & " " & $READMODEL2)
        GUICtrlSetState($MODEL, $GUI_DISABLE)
    TrayTip("Mijn Salon - Check", "Bezig met uitlezen Windows versie...", 3)
        Sleep(1500)
    $WINDOWS = GUICtrlCreateInput("", 16, 80, 249, 21)
        $READOS = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName")
        If @OSArch = "X86" Then
            $ARCH = "32-Bit"
        Else
            $ARCH = "64-Bit"
        EndIf
        GUICtrlSetData($WINDOWS, $READOS & " " & $ARCH)
        GUICtrlSetState($WINDOWS, $GUI_DISABLE)
    TrayTip("Mijn Salon - Check", "Bezig met uitlezen Internet Explorer versie...", 3)
        Sleep(1500)
    $IE = GUICtrlCreateInput("", 16, 104, 249, 21)
        Local $sVersion = FileGetVersion(@ProgramFilesDir & "\Internet Explorer\iexplore.exe")
        GUICtrlSetData($IE, "Internet Explorer: " & $sVersion)
        GUICtrlSetState($IE, $GUI_DISABLE)
    TrayTip("Mijn Salon - Check", "Bezig met uitlezen Silverlight versie...", 3)
        Sleep(1500)
    $SILVERLIGHT = GUICtrlCreateInput("SILVERLIGHT", 16, 128, 249, 21)
        $Silverlight_Version = _NavInfo_GetSilverlightVersion()
            If Not @error Then
                GUICtrlSetData($SILVERLIGHT, "Silverlight: " & $Silverlight_Version)
            EndIf
        GUICtrlSetState($SILVERLIGHT, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)

GUICtrlCreateGroup("Internet info", 8, 160, 265, 113)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $SPEED = GUICtrlCreateInput("", 16, 184, 249, 21)
    TrayTip("Mijn Salon - Check", "Bezig met het testen van internet snelheid...", 3)
        Sleep(1500)
        $SPEEDCHECK = _NetInfo_GetDownloadSpeed()
        GUICtrlSetData($SPEED, $SPEEDCHECK)
        GUICtrlSetState($SPEED, $GUI_DISABLE)
    TrayTip("Mijn Salon - Check", "Bezig met opvragen IP-Adres...", 3)
        Sleep(1500)
    $IPADRES = GUICtrlCreateInput("", 16, 216, 249, 21)
        $PublicIP = _GetIP()
        GUICtrlSetData($IPADRES, $PublicIP)
        GUICtrlSetState($IPADRES, $GUI_DISABLE)
    $PROVIDER = GUICtrlCreateInput("", 16, 248, 249, 21)
    TrayTip("Mijn Salon - Check", "Bezig met opvragen provider naam...", 3)
        Sleep(1500)
        $VAR =  _NetInfo_GetISP()
        GUICtrlSetData($PROVIDER, $VAR)
        GUICtrlSetState($PROVIDER, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$SAVE = GUICtrlCreateButton("Opslaan naar .txt", 8, 280, 131, 25)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$MAIL = GUICtrlCreateButton("Send E-mail", 144, 280, 131, 25)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
        GUICtrlSetState($MAIL, $GUI_DISABLE)

    TrayTip("Mijn Salon - Check", "Controles zijn klaar...", 3)
        Sleep(1500)

GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $SAVE
            SAVE()
        Case $MAIL
            MAIL()
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func SAVE()
    $READIE     = GUICtrlRead($IE)
    $IEDONE     = StringTrimLeft($READIE, 19)
    $READSILVER = GUICtrlRead($SILVERLIGHT)
    $SILVERDONE = StringTrimLeft($READSILVER, 13)

    If FileExists(@Desktopdir & "\check.txt") Then
        FileDelete(@desktopdir & "\check.txt")
    EndIf
    $DEBITNR    = InputBox("Invoeren", "Voer klantnaam in:", "")
    $MEDEWERKER = InputBox("Invoeren", "Uitgevoerd door:", "")
    $FILE       = FileOpen(@desktopdir & "\check.txt", 1)
    $1  = GUICtrlRead($PROC)
    $2  = GUICtrlRead($RAM)
    $3  = GUICtrlRead($MODEL)
    $4  = GUICtrlRead($WINDOWS)
    $5  = $IEDONE
    $6  = $SILVERDONE
    $7  = GUICtrlRead($SPEED)
    $8  = GUICtrlRead($IPADRES)
    $9  = GUICtrlRead($PROVIDER)
        FileWrite($FILE, "Klantnaam:         " & $DEBITNR & @CRLF)
        FileWrite($FILE, "Datum:             " & @MDAY & "-" & @MON & "-" & @YEAR & @CRLF & @CRLF)
        FileWrite($FILE, "Processor:         " & $1 & @CRLF)
        FileWrite($FILE, "Geheugen:          " & $2 & @CRLF)
        FileWrite($FILE, "Model:             " & $3 & @CRLF)
        FileWrite($FILE, "Windows:           " & $4 & @CRLF)
        FileWrite($FILE, "Internet Explorer: " & $5 & @CRLF)
        FileWrite($FILE, "Silverlight:       " & $6 & @CRLF & @CRLF)
        FileWrite($FILE, "Internet Snelheid: " & $7 & @CRLF)
        FileWrite($FILE, "IP-Adres:          " & $8 & @CRLF)
        FileWrite($FILE, "Internet Provider: " & $9 & @CRLF & @CRLF)
        FileWrite($FILE, "Uitgevoerd door:   " & $MEDEWERKER)

MsgBox(4096, "Klaar", "Check is klaar en opgeslagen op het bureaublad")
EndFunc

Func MAIL()
    $READIE     = GUICtrlRead($IE)
    $IEDONE     = StringTrimLeft($READIE, 19)
    $READSILVER = GUICtrlRead($SILVERLIGHT)
    $SILVERDONE = StringTrimLeft($READSILVER, 13)
    $DEBITNR    = InputBox("Invoeren", "Voer klantnaam in:", "")
    $MEDEWERKER = InputBox("Invoeren", "Uitgevoerd door:", "")

    $1  = GUICtrlRead($PROC)
    $2  = GUICtrlRead($RAM)
    $3  = GUICtrlRead($MODEL)
    $4  = GUICtrlRead($WINDOWS)
    $5  = $IEDONE
    $6  = $SILVERDONE
    $7  = GUICtrlRead($SPEED)
    $8  = GUICtrlRead($IPADRES)
    $9  = GUICtrlRead($PROVIDER)
;   $VAR = "Klantnaam:         " & $DEBITNR & @CRLF)
;   $VAR1 = "Datum:             " & @MDAY & "-" & @MON & "-" & @YEAR & @CRLF & @CRLF)
;   $VAR2 = "Processor:         " & $1 & @CRLF)
;   $VAR3   = "Geheugen:          " & $2 & @CRLF)
;   $VAR4   = "Model:             " & $3 & @CRLF)
;   $VAR5   = "Windows:           " & $4 & @CRLF)
;   $VAR6   = "Internet Explorer: " & $5 & @CRLF)
;   $VAR7   = "Silverlight:       " & $6 & @CRLF & @CRLF)
;   $VAR8   = "Internet Snelheid: " & $7 & @CRLF)
;   $VAR9   = "IP-Adres:          " & $8 & @CRLF)
;   $VAR10  = "Internet Provider: " & $9 & @CRLF & @CRLF)
;   $VAR11  = "Uitgevoerd door:   " & $MEDEWERKER)

$SENDMAIL = _INetSmtpMail("smtp.orange.net", "mijnSalon-Check", "m.wingens87@gmail.com", "m.wingens87@gmail.com", "mijnSalon-check", "Test")
    If $SENDMAIL = 1 Then
        MsgBox(4096, "Gelukt", "Mail verzonden.")
    Else
        MsgBox(4096, "Fout", "Mail niet verzonden gebruik opslaan naar .txt")
    EndIf
EndFunc

 

Link to comment
Share on other sites

Thats strange, when i run the exact same script, get nothing with the: _NetInfo_GetDownloadSpeed()

And i get a 0 with: _NetInfo_GetISP() , after checking the UDF this means it fails to check the ISP but when i go the url, this works perfectly.

 

Naamloos.png

Link to comment
Share on other sites

Best way to measure upload will be with FTP transactions. I don't know if this will be a personal program or released to public.
If it's personal, find a "free" web server or a cheap VPS for a private FTP server.

As for Download, same again or you can also create an array of web links that direct to "ISP Test" pages and download a variable 2 - 100MB - same again for ping, and just simply use the ping() function.

Also, as you'll be testing net speeds and connections, it might be a good idea to shorten the code and code a PHP page which displays *most* data relevant to you.

 

Can't really help out on the coding but there's some ideas for you.

Link to comment
Share on other sites

Got the download speed check working now i am struggeling with the ISP check.

GUICtrlCreateGroup("Internet info", 8, 160, 265, 113)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $SPEED = GUICtrlCreateInput("", 16, 184, 249, 21)
    TrayTip("Mijn Salon - Check", "Bezig met het testen van internet snelheid...", 3)
        Sleep(1500)
        $SPEEDCHECK = _NetInfo_GetDownloadSpeed()
            $VAR1 = _ArrayExtract($SPEEDCHECK, 1, 1)
            $VAR2 = _ArrayToString($VAR1, 1)
            $VAR3 = $VAR2 /100
        GUICtrlSetData($SPEED, $VAR3 & " MBit")
        GUICtrlSetState($SPEED, $GUI_DISABLE)
    TrayTip("Mijn Salon - Check", "Bezig met opvragen IP-Adres...", 3)
        Sleep(1500)
    $IPADRES = GUICtrlCreateInput("", 16, 216, 249, 21)
        $PublicIP = _GetIP()
        GUICtrlSetData($IPADRES, $PublicIP)
        GUICtrlSetState($IPADRES, $GUI_DISABLE)
    $PROVIDER = GUICtrlCreateInput("", 16, 248, 249, 21)
    TrayTip("Mijn Salon - Check", "Bezig met opvragen provider naam...", 3)
        Sleep(1500)
        $ISPCHECK =  _NetInfo_GetISP()
        GUICtrlSetData($PROVIDER, $ISPCHECK)
        GUICtrlSetState($PROVIDER, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)

 

Link to comment
Share on other sites

I decided to drop the ISP check, now i am aiming at sending the e-mail. using gmail account.

 

Thx for the support.

Right now this is what i am using for SMTP, i know it is offtopic but maybe some one who is following this thread find it use full.

;
;##################################
; Include
;##################################
#Include<file.au3>
;##################################
$SmtpServer = ""              ; address for the smtp-server to use - REQUIRED
$FromName = ""      ; name from who the email was sent
$FromAddress = ""   ; address from where the mail should come
$ToAddress = ""             ; destination address of the email - REQUIRED
$Subject = ""                   ; subject from the email - can be anything you want it to be
$Body = ""          ; the messagebody from the mail - can be left blank but then you get a blank mail
$AttachFiles = ""   ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed
$CcAddress = ""                             ; address for cc - leave blank if not needed
$BccAddress = ""                            ; address for bcc - leave blank if not needed
$Importance = "Normal"                      ; Send message priority: "High", "Normal", "Low"
$Username = "****"      ; username for the account used from where the mail gets sent - REQUIRED
$Password = "****"                      ; password for the account used from where the mail gets sent - REQUIRED
;$IPPort = 25                               ; port used for sending the mail
;$ssl = 0                                   ; enables/disables secure socket layer sending - put to 1 if using httpS
$IPPort=465                                 ; GMAIL port used for sending the mail
$ssl=1                                      ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS
;##################################
Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
If @error Then
    MsgBox(0, "Error sending message", "Error code:" & @error & "  Description:" & $rc)
EndIf
;##################################
; The UDF
Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
    Local $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.Bcc = $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])
;~          ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console
            If FileExists($S_Files2Attach[$x]) Then
                ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF)
                $objEmail.AddAttachment($S_Files2Attach[$x])
            Else
                ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF)
                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
    If Number($IPPort) = 0 then $IPPort = 25
    $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
    ; Set Email Importance
    Switch $s_Importance
        Case "High"
            $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High"
        Case "Normal"
            $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal"
        Case "Low"
            $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low"
    EndSwitch
    $objEmail.Fields.Update
    ; Sent the Message
    $objEmail.Send
    If @error Then
        SetError(2)
        Return $oMyRet[1]
    EndIf
    $objEmail=""
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

 

Link to comment
Share on other sites

  • Developers

I decided to drop the ISP check, now i am aiming at sending the e-mail. using gmail account.

 

Thx for the support.

Right now this is what i am using for SMTP, i know it is offtopic but maybe some one who is following this thread find it use full.expandpopup

Trying to understand what you are sharing with this post other than somebody else his UDF?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

×
×
  • Create New...