CDO SSL Send SMS Text Message Via Gmail Verizon.

Started by morenos1, July 17, 2018, 09:55:10 AM

Previous topic - Next topic

morenos1

Found script in Tech DB.

;*===========================================================================================
;*    Send SMS Text message through GMAIL account using CDO
;*
;*    Check the following link for detailed help on the CDO Schemas
;*    http://msdn2.microsoft.com/en-us/library/ms872380.aspx
;*
;*===========================================================================================
; Error handling
IntControl(73,1,0,0,0)

;-----------------------------------------------------------
; Modify to fit your needs.
;-----------------------------------------------------------
gmailacctid = 'soandso'
gmailacctPswd =  'secret'
;
;Carriers:
;
; Verizon
;    no_attachments = "@vtext.com"
;   attachements = "@vzwpix.com"
; AT&T
;    no_attachments = "@txt.att.net"
;   attachements = "@mobile.att.net"
; Sprint
;    no_attachments = "@messaging.sprintpcs.com"
;   attachements = "@messaging.sprintpcs.com"
; T-Mobile
;    no_attachments = "@tmomail.net"
;   attachements = "@tmomail.net"
strTo = '5558675309@vtext.com' ;Modify to approprate 'carrier'
Subject = "Test Email"
TextBody = "Send SMS Text message through GMAIL account using CDO"
Attachment  = ""
;-----------------------------------------------------------


; GMAIL Server settings
SMTPServer = "smtp.gmail.com"
AcctName = gmailacctid: "@gmail.com"
Authenticate = 1
UserName = AcctName
Password =  gmailacctPswd
SSL = "YES"
SendUsing = 2
From = AcctName
strCc  = ""
strBCC = ""



oMsg = ObjectCreate("CDO.Message")
oConf = ObjectCreate("CDO.Configuration")
oFields = oConf.Fields

; Define CDO Schemas
oFields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer
oFields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
oFields.Item("http://schemas.microsoft.com/cdo/configuration/smtpaccountname") = AcctName
oFields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = Authenticate
oFields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = UserName
oFields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword")  = Password
oFields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl")= @TRUE
oFields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")= SendUsing
oFields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")= 60 ; Default is 60 Seconds
oFields.Update()


;Send Message
oMsg.Configuration = oConf
oMsg.To = strTo
oMsg.CC = strCC
oMsg.BCC = strBCC
oMsg.From = From
oMsg.Subject = Subject
oMsg.TextBody = TextBody
If Attachment != "" Then oMsg.AddAttachment(Attachment)

oMsg.Send()

oMsg   = 0
oConf   = 0
oFields   = 0
Exit

:WBERRORHANDLER
Pause( "Captured CDO Email Error", LastError():' ':wberrortextstring:@CRLF:@CRLF:"On line:":@CR:wberrorhandlerline)
oMsg   = 0
oConf   = 0
oFields   = 0
Exit

When attempting to run on Win10 I am getting:

1261 COM/CLR: Exception

Line: oMsg.Send()

Any ideas why?

Thanks....

td

You can't send email messages using Google's SMTP server unless you specify that you want to allow "unsafe" applications to access your account so that is the first thing to check.  Can't tell you exactly where that setting is but you can likely find out by "Googling" it...
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

morenos1

Found it:

2.Visit the page https://www.google.com/settings/security/lesssecureapps
3.Click Enable Less Secure Apps.
4.Click Done.

Thank you....