Send SMTP Email via Gmail

Just helped someone get this sorted and thought i woulds share. The trick was to allow Less Secure apps in your account. Here is the link

https://myaccount.google.com/lesssecureapps?pli=1

Turn it on and then just use the normal CDO code.

Dim oEmail, sEmailFrom, sEmailTo, sEmailSubject, sEmailBody,sBCC

' Send email

sEmailTo = "admin@SmarterDimensions.com"
sEmailFrom = "FromAddress@SmarterDimensions.com"
sEmailSubject = "Email Subject"
sEmailBody = "Email Body this is bold"
sBCC = "SmarterDimensions@live.com.au"


Set oEmail      = CreateObject("CDO.Message")

With oEmail
 With .Configuration.Fields
  .Item["http://schemas.microsoft.com/cdo/configuration/smtpusessl"] = True
  .Item["http://schemas.microsoft.com/cdo/configuration/smtpserver"] = "smtp.gmail.com"
  .Item["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 2
  .Item["http://schemas.microsoft.com/cdo/configuration/sendusername"] = "douglas.porton@gmail.com"
  .Item["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = "xxxxxxxxxxx"	
  .Item["http://schemas.microsoft.com/cdo/configuration/smtpserverport"] = 465
  .Item["http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"] = 60
  .Item["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1	
  .Update()		
 End With
End With	

    
oEmail.From     = sEmailFrom
oEmail.To       = sEmailTo
oEmail.BCC      = sBCC
oEmail.Subject  = sEmailSubject
oEmail.HTMLBody = sEmailBody

oEmail.Send()

set oEmail = Null

Just Code : Run MRS from an MRS

This shows us how we can run an MRS from within an MRS file.

Dim oScriptEngine, sScript, oProgram, sResult

' Define the test script
sScript = "Dim x, y, result" + mr.CrLf + _
"x = ""Hello """ + mr.CrLf + _
"y = ""World""" + mr.CrLf + _
"result = x + y"

' Create the script engine and parse
Set oScriptEngine = CreateObject("mrScript.ScriptEngine")

Set oProgram = oScriptEngine.Parsers[0].Parse(sScript, oScriptEngine, 0)

' Execute the script
oScriptEngine.Execute(oProgram, 0)

' Get the result variable value
sResult = oProgram.Variables["result"]  

Printing respondent answers from a Data Management Script

It’s been a while since our last article on printing to word, but we thought that we should continue as we have completed some more work on this. In this article you will see how to take the code that has already been written and use it inside of a DMS script to produce a word document for every record.

Read more

How many Session Engines ( 5.5 )

So we have created some scripts that will show us our possibly concurrency, but what does this mean and how do we work out how many session engines we will need. This article will explain, what a session engine is and why we need at least one of them. We will show you some test results that we have run with the Data Collection Load tool and some standard scripts.

Read more

How many concurrents : Part 4

In the previous articles we designed some scripts to read the IVW log files to work out what the concurrency was, next we will write a script that will try and Estimate what sort of concurrency certain survey criteria might produce. In this article we will take all the information that we have gathered from Data Collection Users to try and produce some example loads.

Read more

How many concurrents : Part 1

Ever wanted to know what has been going on with your DataCollection Server Web concurrents? Interested in finding out if you are going over your limit of allowable concurrents frequently? If the answer to these questions is yes , then this set of articles is for you. In it we will show you how to look at the log files produced on your servers and calculate what has been going on and when. It should be noted that this article assumes that you have some knowledge of Data Management scripts as well as Tables scripts and VBA.

Read more

%d bloggers like this: