Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2004
    Posts
    3

    Unanswered: How do I get the contents of a text file to be the body of my E-mail


    I am passing variables to my VBscript using a command line (see below)

    here is the VBScript I am starting with named (emailthis.vbs):

    Set objEmail = CreateObject("CDONTS.NewMail")
    objEmail.From = "from addr goes here"

    objEmail.To = WScript.Arguments(0)
    objEmail.Subject = WScript.Arguments(1)
    objEmail.Body = WScript.Arguments(2)
    objEmail.AttachFile WScript.Arguments(3)

    objEmail.Send

    set objEmail = Nothing

    The command line..............

    emailthis.vbs "someone@unknown.com", "this is the subject", "Text file goes here", "attachment"

  2. #2
    Join Date
    May 2004
    Location
    Ohio
    Posts
    61
    what operating system are you running?

  3. #3
    Join Date
    May 2004
    Location
    Ohio
    Posts
    61
    Nevermind that, i missed your question. Are you getting any errors?

  4. #4
    Join Date
    Dec 2004
    Posts
    3
    I'm not getting any errors, but I have not started to write and test the Script. I found this code on the net and plan to start from there. I'm at at loss on how to code this. I am a Novis VB user. I just started write VB scritps.

  5. #5
    Join Date
    Dec 2004
    Posts
    3
    I just tested this script and it works when I pass it the correct data from the commnad line.

    set Paul = CreateObject("CDONTS.NewMail")
    Paul.From = "server name"

    Paul.To = WScript.Arguments(0)

    Paul.Subject = WScript.Arguments(1)

    Paul.Body = WScript.Arguments(2)

    Paul.Attachfile WScript.Arguments(3)

    Paul.Send

    set Paul = Nothing

    I need to take arugment #2 which is the text file I want to use, and take the text out of the file (argument2) and make it the body of the E-mail.
    Last edited by Bellpr; 12-10-04 at 17:18.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •