title: vbscript cdo send message with smtp authentication won't allow variable in sending to field
body: <p>recently added smtp authentication to our mail server and found a very funny thing. When using a variable in the to cdomessage.to field it will come back with error '8004020f'. However if I hardcode the email address it works fine. here is my code:</p>
  
  <pre><code>varEmail = "someoneelse@somesite.com"
  set cdoMessage = CreateObject("CDO.Message")
  set cdoConfig = CreateObject("CDO.Configuration")
  With cdoConfig.Fields
      .Item(cdoSendUsingMethod) = 2
      .Item(cdoSMTPServer) = "localhost" 
      .Item(cdoSMTPServerPort) = 25 
      .Item(cdoSMTPconnectiontimeout) = 10
      .Update 
  end With
  CdoMessage.Configuration = cdoConfig
  cdoMessage.Subject="NEW EMAIL"
  cdoMessage.From="someone@somesite.com"
  cdoMessage.To=varEmail
  cdoMessage.TextBody="HELLO WORLD!"
  cdoMessage.Send
  set cdoMessage=nothing
  set cdoConfig=nothing
  </code></pre>
  
  <p>How can I fix this so that I can use a variable in the cdoMessage.To field </p>