Results 1 to 4 of 4

Thread: VBscript to send email

  1. #1
    Expert Member
    Join Date
    Jun 2008
    Answers
    204

    VBscript to send email

    hi,

    i try to write a short script to send a simple email. i am not sure how cdo.message work. Could you look into the below and tell me what is missing. When run error displays athe the red line.

    Note: this script is to run on a workstation without internet connection. the workstation has outlook and intranet.

    Dim objEmail, cdoConfig

    SET objEmail = CreateObject("CDO.Message")
    SET cdoConfig = CreateObject("CDO.Configuration")

    cdoConfig.Fields.Item(cdoSendUsingMethod) = 25 " ' cdoSendUsingPorts
    cdoConfig.Fields.Item(cdostmpserver) = "TestServer1" ' "what this should be"
    cdoConfig.update


    SET objEmail.Configuration = cdoConfig

    objEmail.From = "myadd@abc.com"
    objEmail.To = "myadd@abc.com"
    objEmail.cc = "myadd@abc.com"
    objEmail.Subject = "Testing"
    objEmail.Textbody = "EmailBody is testing"
    objEmail.Send

    SET CDOConfig = Nothing
    SET objEmail = Nothing

    Last edited by learqtptesting; 09-03-2010 at 02:07 PM.

  2. #2
    Contributing Member
    Join Date
    Jul 2010
    Answers
    44

    Re: VBscript to send email

    The variable from the SMTP Server is wrong. The 'M' and 'T' are the wrong way round

    cdoConfig.Fields.Item(cdoSendUsingMethod) = 25 " ' cdoSendUsingPorts
    cdoConfig.Fields.Item(cdoSMTPServer) = "TestServer1" ' "what this should be"
    cdoConfig.update


  3. #3
    Expert Member
    Join Date
    Jun 2008
    Answers
    204

    Re: VBscript to send email

    millersi,
    thanks for your reply.

    I made correction but it still has error at

    cdoConfig.Fields.Item(cdoSendUsingMethod) = 25 'cdoSendUsingPorts

    the error states

    Error: "Arguments are wrong type, are out of acceptable range, or are conflicted with one another."

    Code: 800A0BB9
    Source: ADODB.Feild

    Am I using the correct field?


  4. #4
    Contributing Member
    Join Date
    Jul 2010
    Answers
    44

    Re: VBscript to send email

    I have had a look at my code and the fields I am using are a little different.

    cdoConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    codConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") 'exchange_server'


    I am using the above code on clients that do not have an internet connection as well only intranet so should work for you.


  5.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact