Solved VBScript - CDO.message

cashcashjonny

New Member
Hello. I have tried this VBScript on my mothers Vista Home Premium & it works.

Set Msg = CreateObject("CDO.Message")
With Msg
.To = "[email protected]"
.From = "[email protected]"
.Subject = "Hello"
.TextBody = "sample CDO message"
.Send
End With

But to do the same thing on my windows 7, I need to add SMTP server details like this:

Const fromEmail = "[email protected]"
Const password = "*******"
Dim msg, emailConfig
Set msg = CreateObject("CDO.Message")
With Msg
.From = fromEmail
.To = "[email protected]"
.Subject = "Hello"
.TextBody ="sample CDO message"
Set emailConfig = msg.Configuration
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = fromEmail
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = password
emailConfig.Fields.Update
.Send
End With
Set msg = nothing
Set emailConfig = nothing

I want to know if the first script works on all vista machines or if it only works because of something else (maybe the network card), so I will know whether to get a copy of vista or a different network card - (ultimately I want to send email without logging on to a SMTP server or going round to borrow my mums computer).

Any intelligence you can supply in relation to this matter would be much appreciated.
Thanks.
 

My Computer

System One

  • Manufacturer/Model
    compaq
    Other Info
    My Mum has Vista Home premium & I'm thinking about getting it for myself.
Back
Top