![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| Guest | VBScript and CDOSYS I am using CDOSYS to send emails containing variables that have been enetered via a form on as asp page. Until now, each variable has contained a single value, as shown below. <%@ Language="VBScript" %> <% Option Explicit %> <html> <head> <title>Request Emailed</title> </head> <body> <% 'Declare variables Dim sch, cdoConfig, cdoMessage, holiday_ID, email, auth, id, firstlastname, startdate, enddate, email_sent, NumberofDays, AMPM, AMPMDate, DaysifAuthorised email_sent = -1 enddate = Request.Form("enddate") startdate = Request.Form("startdate") firstlastname = Request.Form("firstlastname") holiday_ID = Request.Form("myname") NumberofDays = Request.Form("NumberofDays") AMPM = Request.Form("AMPM") AMPMDate = Request.Form("AMPMDate") DaysifAuthorised = Request.Form("DaysifAuthorised") sch = "http://schemas.microsoft.com/cdo/configuration/" Set cdoConfig = CreateObject("CDO.Configuration") With cdoConfig.Fields 'Set CDO Port .Item(sch & "sendusing") = 2 'Set mailserver name either IP address, mail.yoursite.com or localhost .Item(sch & "smtpserver") = "192.156.217.6" 'Set SMTP port which is 25 by default .Item(sch & "smtpserverport") = 25 'Set number of seconds before timeout .Item(sch & "smtpconnectiontimeout") = 60 .update End With Set cdoMessage = CreateObject("CDO.Message") With cdoMessage Set .Configuration = cdoConfig .From = "administrator@xxxxxx" .To = "paul@xxxxxx" .Subject = ""& holiday_ID 'Send the email in HTML format .HTMLBody = "Name of Applicant:" & firstlastname & "<br>Holiday Start Date: " & startdate & "<br>Holiday End Date: " & enddate & "<br>Number of Working Days:" & NumberofDays & AMPM & AMPMDate & "<br>Leave oustanding: " & DaysifAuthorised &"<br><a href='http://192.156.217.134/authorise.asp?id="& holiday_ID &"'>Authorise Holiday Request</a><br><br><a href='http:// 192.156.217.134/authorise.asp?id="& holiday_ID &"'>delete record</ a><br><br>" .Send End With Set cdoMessage = Nothing Set cdoConfig = Nothing Now I would like to add to the body of the email a ADO Recordset object. I would normally display the results in a html table, %><table border="1" width="100%"> <%do until rs.EOF%> <tr> <%for each x in rs.Fields%> <td><%Response.Write(x.value)%></td> <%next rs.MoveNext%> </tr> <%loop rs.close conn.close %> Do you know how I can include this in my email? Regards, |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| New to VBscript, Help please! | VB Script | |||
| cdosys.dll xp and vista different? | General Discussion | |||
| CSS and VBscript | VB Script | |||
| Where is VBscript now? | VB Script | |||
| How to do No hang up VBScript (nohup for VBScript) | VB Script | |||