Need to add attachment to Windows Script File written using VBScript

I have inherited a web application (.NET) that uses a Windows Script File to generate an email every Friday to managers when their contract worker's contract is expiring. The WSF uses VBScript and now the business owner of the app wants to attach a Word document to the email. How do I go about adding that document to the WSF? Thanks!
khawkins96Asked:
Who is Participating?
 
tim_mcgueCommented:
It looks like you are using ASPEmail to do the sending.  You can read more about attachments here: http://www.aspemail.com/manual_03.html

To send the attachment you will need to simply add a line like the following:
mail.AddAttachment "c:\temp\YourFile.doc"

obviously replacing the last part with your actual file you want to send.
0
 
tim_mcgueCommented:
Well, you could very easily use a helper tool like Blat:  http://www.blat.net/

The question here is how are you sending your email now.  There are a bunch of different ways you can do that, and they each probably have a method for sending an attachment.  Can you post a snippet of code for the way you are sending the base e-mail now?

0
 
khawkins96Author Commented:
Thanks for responding! Here's a snipet! If you need more, please let me know. Thanks for looking at it!

<script language="VBScript">
Set Mail = CreateObject("Persits.MailSender")
mail.Host = "atnascom02.nasco.local"
mail.FromName="Contingent Workforce"
mail.From="CW@nasco.com"
            
set ReportToSet = CreateObject("ADODB.Recordset")
set COntractSet = CreateObject("ADODB.Recordset")
lcsql="select distinct contract_ReporttoNum  from CTC_Contract where Contract_enddate>='" & date   & "' and Contract_enddate<='" & dateadd("d",14,Date) &  "' order by contract_reportToNum desc"
            'WScript.Echo Lcsql
            ReportToSet.Open lcsql,conn,3,3
            'WScript.Echo reportToset.RecordCount
            'WScript.Echo "Test"
            
            while not ReportToSet.EOF
                  'WScript.Echo "running"
                  lcsql="select * from CTC_contract,dir_directory where Contract_ReporttoNum=empid and Contract_enddate>'" & date  & "' and Contract_enddate<='" & dateadd("d",14,Date) & "' and contract_reportTonum=" & cint(reportToset.Fields("contract_ReportToNum"))
                  'WScript.Echo Lcsql
                  COntractSet.Open lcsql,conn
                  if not contractset.EOF then
if not isnull(COntractSet.Fields("email")) then
emailTo=COntractSet.Fields("email")
mail.AddAddress emailto
mail.Subject="CW - Alert"
P_Body="1. The following contingent workforce will expire:" & chr(10)& chr(10)      
while not  contractset.EOF            
contractname=contractset.Fields("contract_Fname") & " " & contractset.Fields("contract_Lname")
Endnddate=contractset.Fields("contract_EndDate")
                                    
P_body=P_Body & "Name: " & contractname & chr(10)
P_body=P_Body & "End Date: " & endDate &chr(10) & chr(10)
contractset.MoveNext
wend
P_body=P_body & "2. If you are extending, then do not forget to change your item." & Chr(10) & Chr(10)& Chr(10) & Chr(10)
P_body=P_body & "3. On this individuals last day, it is your responsibility to collect the following items:" & chr(10) & Chr(10)
P_body=P_body & CHr(42)  & "Security Access Card - return to Office Manager or Office Services Admin Asst"& chr(10) & Chr(10)
P_body=P_body & CHr(42)  & "Key(s) - return to Office Manager"& chr(10) & Chr(10)
P_body=P_body & CHr(42) & "Confidential and business related documents and information - Hiring Manager to determine whether the documents will be saved or shredded"& chr(10) & Chr(10)
P_body=P_body & CHr(42) & "Other NASCO owned equipment (i.e. laptop - return to IS; headset - return to Office Services Coordinator)"& chr(10) & Chr(10)
mail.Body=P_Body
mail.AddBcc ("khawkins@nasco.com")

                  
0
 
khawkins96Author Commented:
Wonderful! Thank you for that info!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.