Jump to content

Best SMS Sender yet!


LimeSeed
 Share

Recommended Posts

  • Moderators

I'm getting more confused :S

Lets see.

If I find the SMTP of my operator, and I send a "sms" from my pc to my phone, will I be charged?

*My operator doesn't charge me when I receive sms from "somebody".

If you get free messages on your plan, then when you receive messages this way it will still be free. However, some plans charge people per message sent and per message received. So if you or whomever you're sending to has a plan like that ... you or they will be charged.

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.

Link to comment
Share on other sites

  • Moderators

Thanks for the answers >_<

Just one more question :) ¿If I send a sms from my pc, how could my operator charge me? :S

If you send it using your phone credentials.

Keep in mind... This still goes through their server.

Edited by SmOke_N

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.

Link to comment
Share on other sites

Easy fix for the text flickering

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=SMS.ico
#AutoIt3Wrapper_outfile=SMS.exe
#AutoIt3Wrapper_Res_Comment=By: Isaac Flaum
#AutoIt3Wrapper_Res_Description=Allows computer to send SMS messages to phones
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Isaac Flaum 2008
#AutoIt3Wrapper_Res_Language=1033
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GuiScrollBars.au3>
#include<file.au3>
#include<misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ScrollBarConstants.au3>
#include <EditConstants.au3>
$s_SmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED
$s_FromName = "" ; name from who the email was sent
$s_FromAddress = "" ;  address from where the mail should come
$s_ToAddress = "" ; destination address of the email - REQUIRED
$s_Subject = "" ; subject from the email - can be anything you want it to be
$as_Body = "" ; the messagebody from the mail - can be left blank but then you get a blank mail
$s_AttachFiles = "" ; the file you want to attach- leave blank if not needed
$s_CcAddress = "" ; address for cc - leave blank if not needed
$s_BccAddress = "" ; address for bcc - leave blank if not needed
$s_Username = "" ; username for the account used from where the mail gets sent  - Optional (Needed for eg GMail)
$s_Password = "" ; password for the account used from where the mail gets sent  - Optional (Needed for eg GMail)
$IPPort = 465 ; port used for sending the mail
$ssl = 1 ; enables/disables secure socket layer sending - put to 1 if using httpS

$readtxt = ""
Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
GUICreate("SMS", 160, 180)
$send = GUICtrlCreateButton("Send", 5, 150, 150, 25)
$phonenum = GUICtrlCreateLabel("Phone Number:", 5, 5, 80, 20)
$phonesubject = Guictrlcreatelabel("Subject:", 5, 30, 80, 20)
$subject = guictrlcreateinput("", 50, 30, 105, 20)
guictrlsetstate(-1, $GUI_DISABLE)
$to = GUICtrlCreateInput("", 85, 5, 70, 20)
$attatchment = GUICtrlCreateButton("Attatchment", 5, 55, 80, 20)
$carrier = GUICtrlCreateCombo("Carrier", 90, 55, 65, 20)
GUICtrlSetData(-1, "Verizon|AT&T|Sprint|T-Mobile", "Carrier")
$numchar = GUICtrlCreateLabel("Characters Left: 160", 5, 130, 100, 20)
$txt = GUICtrlCreateEdit("", 5, 85, 150, 40, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
guisetbkcolor(0x99cc66)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case ($msg = $attatchment)
            $s_AttachFiles = FileOpenDialog("Attatchment", @DesktopDir, "Files (*.mid;*.gif;*.jpg;*.mp3)")
            guictrlsetstate($subject, $GUI_ENABLE)
        Case ($msg = -3)
            Exit
        
        Case GUICtrlRead($txt) <>  $readtxt
            $readtxt = GUICtrlRead($txt)
            $length = StringLen($readtxt)
            $actualchar = Execute(160 - $length)
            GUICtrlSetData($numchar, "Characters Left: " & $actualchar)

        Case ($msg = $send)
            $s_Subject = guictrlread($subject)
            $as_Body = GUICtrlRead($txt)
            $s_ToAddress = GUICtrlRead($to)
            $wacarrier = GUICtrlRead($carrier)
            Select
                Case ($wacarrier = "Verizon")
                    If $s_AttachFiles = "" Then
                        $s_ToAddress = $s_ToAddress & "@vtext.com"
                    Else
                        $s_ToAddress = $s_ToAddress & "@vzwpix.com"
                    EndIf
                Case ($wacarrier = "AT&T")
                    If $s_AttachFiles = "" Then
                        $s_ToAddress = $s_ToAddress & "@txt.att.net"
                    Else
                        $s_ToAddress = $s_ToAddress & "@mobile.att.net"
                    EndIf
                Case ($wacarrier = "Sprint")
                    If $s_AttachFiles = "" Then
                        $s_ToAddress = $s_ToAddress & "@messaging.sprintpcs.com"
                    Else
                        $s_ToAddress = $s_ToAddress & "@messaging.sprintpcs.com"
                    EndIf
                Case ($wacarrier = "T-Mobile")
                    If $s_AttachFiles = "" Then
                        $s_ToAddress = $s_ToAddress & "@tmomail.net"
                    Else
                        $s_ToAddress = $s_ToAddress & "@tmomail.net"
                    EndIf
            EndSelect
            $sendprog = ProgressOn("Sending", "Sending Message...")
            $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl)
            If @error Then
                MsgBox(0, "Error sending message", "Error code:" & @error & "  Rc:" & $rc)
            EndIf
           
        EndSelect
   
WEnd

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)
    ProgressSet(10)
    $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    ProgressSet(20)
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    ProgressSet(30)
    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])
            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
    ProgressSet(40)
    $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
    ProgressSet(60)
    ;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
    ProgressSet(80)
    ;Update settings
    $objEmail.Configuration.Fields.Update
    ; Sent the Message
    $objEmail.Send
    If @error Then
        SetError(2)
        Return $oMyRet[1]
    EndIf
    ProgressSet(100)
    ProgressOff()
EndFunc   ;==>_INetSmtpMailCom
;
;
; Com Error Handler
Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Link to comment
Share on other sites

Updated it with more providers because i was bored :) so bout the code size i dont got that down yet

#NoTrayIcon
#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=SMS.ico
#AutoIt3Wrapper_outfile=SMS.exe
#AutoIt3Wrapper_Res_Comment=By: Isaac Flaum
#AutoIt3Wrapper_Res_Description=Allows computer to send SMS messages to phones
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Isaac Flaum 2008
#AutoIt3Wrapper_Res_Language=1033
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GuiScrollBars.au3>
#include<file.au3>
#include<misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ScrollBarConstants.au3>
#include <EditConstants.au3>
$s_SmtpServer = "smtp.gmail.com"; address for the smtp-server to use - REQUIRED
$s_FromName = ""; name from who the email was sent
$s_FromAddress = "";  address from where the mail should come
$s_ToAddress = ""; destination address of the email - REQUIRED
$s_Subject = ""; subject from the email - can be anything you want it to be
$as_Body = ""; the messagebody from the mail - can be left blank but then you get a blank mail
$s_AttachFiles = ""; the file you want to attach- leave blank if not needed
$s_CcAddress = ""; address for cc - leave blank if not needed
$s_BccAddress = ""; address for bcc - leave blank if not needed
$s_Username = ""; username for the account used from where the mail gets sent  - Optional (Needed for eg GMail)
$s_Password = ""; password for the account used from where the mail gets sent  - Optional (Needed for eg GMail)
$IPPort = 465; port used for sending the mail
$ssl = 1; enables/disables secure socket layer sending - put to 1 if using httpS

$readtxt = ""
Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
GUICreate("SMS", 220, 180)
$send = GUICtrlCreateButton("Send", 5, 150, 150, 25)
$phonenum = GUICtrlCreateLabel("Phone Number:", 5, 5, 80, 20)
$phonesubject = Guictrlcreatelabel("Subject:", 5, 30, 80, 20)
$subject = guictrlcreateinput("", 50, 30, 105, 20)
guictrlsetstate(-1, $GUI_DISABLE)
$to = GUICtrlCreateInput("", 85, 5, 70, 20)
$attatchment = GUICtrlCreateButton("Attatchment", 5, 55, 80, 20)
$carrier = GUICtrlCreateCombo("Carrier", 90, 55, 115, 20)
GUICtrlSetData(-1, "Verizon|AT&T|Sprint|T-Mobile|Rogers Wireless|Cingular|Bell Atlantic|Bell Mobility Canada|Cingular One|Comcast|Fido|Telus|My Cricket", "Carrier")
$numchar = GUICtrlCreateLabel("Characters Left: 160", 5, 130, 100, 20)
$txt = GUICtrlCreateEdit("", 5, 85, 150, 40, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
guisetbkcolor(0x99cc66)
GUISetState(@SW_SHOW)
;
While 1
    $msg = GUIGetMsg()
    Select
        Case ($msg = $attatchment)
            $s_AttachFiles = FileOpenDialog("Attatchment", @DesktopDir, "Files (*.mid;*.gif;*.jpg;*.mp3)")
            guictrlsetstate($subject, $GUI_ENABLE)
        Case ($msg = -3)
            Exit
        
        Case GUICtrlRead($txt) <>  $readtxt
            $readtxt = GUICtrlRead($txt)
            $length = StringLen($readtxt)
            $actualchar = Execute(160 - $length)
            GUICtrlSetData($numchar, "Characters Left: " & $actualchar)

        Case ($msg = $send)
            $s_Subject = guictrlread($subject)
            $as_Body = GUICtrlRead($txt)
            $s_ToAddress = GUICtrlRead($to)
            $wacarrier = GUICtrlRead($carrier)
            Select
                Case ($wacarrier = "Verizon")
                    If $s_AttachFiles = "" Then
                        $s_ToAddress = $s_ToAddress & "@vtext.com"
                    Else
                        $s_ToAddress = $s_ToAddress & "@vzwpix.com"
                    EndIf
                Case ($wacarrier = "Rogers Wireless")
                    If $s_AttachFiles = "" Then
                        $s_ToAddress = $s_ToAddress & "@pcs.rogers.com"
                    Else
                        $s_ToAddress = $s_ToAddress & "@pcs.rogers.com"
                    EndIf
                Case ($wacarrier = "Cingular")
                    If $s_AttachFiles = "" Then
                        $s_ToAddress = $s_ToAddress & "@cingularme.com"
                    Else
                        $s_ToAddress = $s_ToAddress & "@cingularme.com"
                    EndIf
                Case ($wacarrier = "Bell Atlantic")
                    If $s_AttachFiles = "" Then
                        $s_ToAddress = $s_ToAddress & "@message.bam.com"
                    Else
                        $s_ToAddress = $s_ToAddress & "@message.bam.com"
                    EndIf
                Case ($wacarrier = "Bell Mobility Canada")
                    If $s_AttachFiles = "" Then
                        $s_ToAddress = $s_ToAddress & "@txt.bell.ca"
                    Else
                        $s_ToAddress = $s_ToAddress & "@txt.bell.ca"
                    EndIf
                Case ($wacarrier = "Cingular One")
                    If $s_AttachFiles = "" Then
                        $s_ToAddress = $s_ToAddress & "@mobile.celloneusa.com"
                    Else
                        $s_ToAddress = $s_ToAddress & "@mobile.celloneusa.com"
                    EndIf
                Case ($wacarrier = "Comcast")
                    If $s_AttachFiles = "" Then
                        $s_ToAddress = $s_ToAddress & "@comcastpcs.textmsg.com"
                    Else
                        $s_ToAddress = $s_ToAddress & "@comcastpcs.textmsg.com"
                    EndIf
                Case ($wacarrier = "Fido")
                    If $s_AttachFiles = "" Then
                        $s_ToAddress = $s_ToAddress & "@fido.ca"
                    Else
                        $s_ToAddress = $s_ToAddress & "@fido.ca"
                    EndIf
                Case ($wacarrier = "Telus")
                    If $s_AttachFiles = "" Then
                        $s_ToAddress = $s_ToAddress & "msg.telus.com"
                    Else
                        $s_ToAddress = $s_ToAddress & "msg.telus.com"
                    EndIf
                Case ($wacarrier = "My Cricket")
                    If $s_AttachFiles = "" Then
                        $s_ToAddress = $s_ToAddress & "@mms.mycricket.com"
                    Else
                        $s_ToAddress = $s_ToAddress & "@sms.mycricket.com"
                    EndIf
                Case ($wacarrier = "AT&T")
                    If $s_AttachFiles = "" Then
                        $s_ToAddress = $s_ToAddress & "@txt.att.net"
                    Else
                        $s_ToAddress = $s_ToAddress & "@mobile.att.net"
                    EndIf
                Case ($wacarrier = "Sprint")
                    If $s_AttachFiles = "" Then
                        $s_ToAddress = $s_ToAddress & "@messaging.sprintpcs.com"
                    Else
                        $s_ToAddress = $s_ToAddress & "@messaging.sprintpcs.com"
                    EndIf
                Case ($wacarrier = "T-Mobile")
                    If $s_AttachFiles = "" Then
                        $s_ToAddress = $s_ToAddress & "@tmomail.net"
                    Else
                        $s_ToAddress = $s_ToAddress & "@tmomail.net"
                    EndIf
            EndSelect
            $sendprog = ProgressOn("Sending", "Sending Message...")
            $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl)
            If @error Then
                MsgBox(0, "Error sending message", "Error code:" & @error & "  Rc:" & $rc)
            EndIf
           
        EndSelect
   
WEnd

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)
    ProgressSet(10)
    $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    ProgressSet(20)
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    ProgressSet(30)
    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])
            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
    ProgressSet(40)
    $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
    ProgressSet(60)
   ;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
    ProgressSet(80)
   ;Update settings
    $objEmail.Configuration.Fields.Update
   ; Sent the Message
    $objEmail.Send
    If @error Then
        SetError(2)
        Return $oMyRet[1]
    EndIf
    ProgressSet(100)
    ProgressOff()
EndFunc  ;==>_INetSmtpMailCom
;
;
; Com Error Handler
[Cheeky]Comment[/Cheeky]
Link to comment
Share on other sites

Updated it with more providers because i was bored >_< so bout the code size i dont got that down yet

Included above suggestions, with a smaller size :)

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=SMS.ico
#AutoIt3Wrapper_outfile=SMS.exe
#AutoIt3Wrapper_Res_Comment=By: Isaac Flaum
#AutoIt3Wrapper_Res_Description=Allows computer to send SMS messages to phones
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Isaac Flaum 2008
#AutoIt3Wrapper_Res_Language=1033
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GuiScrollBars.au3>
#include<file.au3>
#include<misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ScrollBarConstants.au3>
#include <EditConstants.au3>
#include <GuiComboBox.au3>


$s_SmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED
$s_FromName = "" ; name from who the email was sent
$s_FromAddress = "" ;  address from where the mail should come
$s_ToAddress = "" ; destination address of the email - REQUIRED
$s_Subject = "" ; subject from the email - can be anything you want it to be
$as_Body = "" ; the messagebody from the mail - can be left blank but then you get a blank mail
$s_AttachFiles = "" ; the file you want to attach- leave blank if not needed
$s_CcAddress = "" ; address for cc - leave blank if not needed
$s_BccAddress = "" ; address for bcc - leave blank if not needed
$s_Username = "" ; username for the account used from where the mail gets sent  - Optional (Needed for eg GMail)
$s_Password = "" ; password for the account used from where the mail gets sent  - Optional (Needed for eg GMail)
$IPPort = 465 ; port used for sending the mail
$ssl = 1 ; enables/disables secure socket layer sending - put to 1 if using httpS


; [0]= Company, 
; [1]= Web Address
; [2]= Alternate Web Address
; [3]= Number format
Global $avCarriers[14][4] = [ _
['AT&T PCS', 'txt.att.net', 'mobile.att.net', '%d'], _
['Bell Atlantic', 'message.bam.com', '', '%d'], _
['Bell Mobility (Canada)', 'txt.bell.ca', '', '%d'], _
['Cingular Wireless', 'cingularme.com', '', '1%d'], _
['Cellular One', 'mobile.celloneusa.com','', '%d'], _
['Comcast', 'comcastpcs.textmsg.com', '','%d'], _
['Cricket', 'sms.mycricket.com', '','%d'], _
['Fido', 'fido.ca', '','%d'], _
['Rogers Wireless', 'pcs.rogers.com', '', '%d'], _
['Sprint PCS', 'messaging.sprintpcs.com', '', '%d'], _
['T-Mobile', 'tmomail.net', '', '%d'], _
['Telus', 'msg.telus.com', '','%d'], _
['Verizon Wireless', 'vtext.com', 'vzwpix.com', '%d'], _
['Virgin Mobile Canada', '@vmobile.ca', '','%d'] _
]

Global $readtxt = ""
Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
GUICreate("SMS", 200, 180)
$send = GUICtrlCreateButton("Send", 5, 150, 150, 25)
$phonenum = GUICtrlCreateLabel("Phone Number:", 5, 5, 100, 20)
$phonesubject = Guictrlcreatelabel("Subject:", 5, 30, 120, 20)
$subject = guictrlcreateinput("", 50, 30, 140, 20)
guictrlsetstate(-1, $GUI_DISABLE)
$to = GUICtrlCreateInput("", 85, 5, 100, 20)
GUICtrlSetLimit(-1, 20, 7)
$attatchment = GUICtrlCreateButton("Attatchment", 5, 55, 80, 20)
$carrier = GUICtrlCreateCombo("Carrier", 90, 55, 100, 20, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
For $i = 0 To UBound($avCarriers)-1
    _GUICtrlComboBox_AddString($carrier, $avCarriers[$i][0])
Next
$numchar = GUICtrlCreateLabel("Characters Left: 160", 5, 130, 100, 20)
$txt = GUICtrlCreateEdit("", 5, 85, 180, 40, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetLimit(-1, 160)
guisetbkcolor(0x99cc66)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case ($msg = $attatchment)
            $s_AttachFiles = FileOpenDialog("Attatchment", @DesktopDir, "Files (*.mid;*.gif;*.jpg;*.mp3)")
            guictrlsetstate($subject, $GUI_ENABLE)
        Case ($msg = -3)
            Exit
        Case GUICtrlRead($txt) <>  $readtxt
            $readtxt = GUICtrlRead($txt)
            $length = StringLen($readtxt)
            $actualchar = Execute(160 - $length)
            GUICtrlSetData($numchar, "Characters Left: " & $actualchar)
            
        Case ($msg = $send) 
            $s_Subject = guictrlread($subject)
            $as_Body = GUICtrlRead($txt)
            $s_ToAddress = GUICtrlRead($to)
            
            $iSelect = _GUICtrlComboBox_GetCurSel($carrier) -1
            
            If $iSelect >= 0 Or $iSelect <= UBound($avCarriers)-1  And StringLen($s_ToAddress) Then
                $wacarrier = $avCarriers[$iSelect][0]
                
                If $s_AttachFiles <> "" Then
                    If $avCarriers[$iSelect][2] <> "" Then 
                        $avCarriers[$iSelect][1] = $avCarriers[$iSelect][2]
                    EndIf
                EndIf

                $s_ToAddress = StringFormat($avCarriers[$iSelect][3], $s_ToAddress) &'@'& $avCarriers[$iSelect][1]
                
                    ConsoleWrite($s_ToAddress &@lf)
                
                $sendprog = ProgressOn("Sending", "Sending Message...")
                $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl)
                 If @error Then
                    MsgBox(0, "Error sending message", "Error code:" & @error & "  Rc:" & $rc)
                 EndIf
            EndIf
           
        EndSelect
   
WEnd

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)
    ProgressSet(10)
    $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    ProgressSet(20)
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    ProgressSet(30)
    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])
            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
    ProgressSet(40)
    $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
    ProgressSet(60)
    ;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
    ProgressSet(80)
    ;Update settings
    $objEmail.Configuration.Fields.Update
    ; Sent the Message
    $objEmail.Send
    If @error Then
        SetError(2)
        Return $oMyRet[1]
    EndIf
    ProgressSet(100)
    ProgressOff()
EndFunc   ;==>_INetSmtpMailCom
;
;
; Com Error Handler
Edited by mrRevoked
Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Link to comment
Share on other sites

Thanks for the post, though I don't know if one could call that the best SMS text messaging tool out there. Aside from AutoIt's GUI interface options, this could be written in VBScript, VB, or .NET w/ C#/VB. The options with this tool are limited as it doesn't cover worldwide SMS and if you want to support SMS providers not listed, you will have to add more code to the tool, which is ok though if you are a developer/scripter. :)

Too bad Virgin Mobiles not in the list by default >_<

Also wanted to mention some things:

This is a bit inappropriate but you could get the same thing by hacking Google's Send To Phone feature. Just look into the Send To Phone Page's HTML and you can build a form submission script that posts to the Google service. It need not be written in AutoIt only. You can do this with XMLHttpRequest COM object within VBScript or AutoIt script. With this approach you need not know the SMS email format and you can send to whatever service provider Google supports.

For an SMS tool that doesn't require supplying SMTP account credentials, check out mxmail.exe that I developed, available at: http://www.codeproject.com/KB/tips/easysmtpandsms.aspx

It's a command line executable. I had been wanting to build a COM version (which you could use with AutoIt), but don't have the expertise to do that right now. If there are COM component developers here, maybe you can give me some pointers on how to build it.

arn't you special?

global $warming = true
Link to comment
Share on other sites

  • 4 months later...

I get this error when running...

The requested action with this object has failed.:

$objEmail.Send

$objEmail.Send^ ERROR

Same.

Do you have more info on that object --> $objEmail = ObjCreate("CDO.Message") Something to install, cdosys.dll ?

Edited by M a k a v e l !

[font="Lucida Sans Unicode"]M a k. a v e L ![/font]

Link to comment
Share on other sites

So, if I ask someone how atomic bomb works and that someone says:

where it says press, you need to press

where it says press again, you press again

ok?

and I say ok.

and he says: don't ask me that stupid question again.

and I say ok, sorry... and thanks, now I know how atomic bomb works.

Ahaha, that made me laugh !
Link to comment
Share on other sites

  • 3 weeks later...
  • 5 years later...

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

  • Recently Browsing   0 members

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