troubleshooting Question

Trouble sending an email with multiple attachments using CDONTS

Avatar of Mark Drelinger
Mark DrelingerFlag for United States of America asked on
VB Script
5 Comments1 Solution65 ViewsLast Modified:
I am trying to send an email with multiple attachments using CDONTS.
The code below sends the email, but never attaches anything.
I feel like I've got a vb script errror where I scroll through the record set rsEQUIPInvoicesAttach, which contains 2 records.
If I take that loop out of my code, I can manually create an email with multiple attachments, so I'm confident my CDO syntax is correct.

<% if (cStr(Request("Submit")) <> "") Then
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.From = Request("varFrom")
objCDO.To = Request("varTo")
objCDO.Subject = "Invoices from Schmidt Equipment"
objCDO.Body = "Invoices from Schmidt Equipment"

While ((Repeat6__numRows <> 0) AND (NOT rsEQUIPInvoicesAttach.EOF))
           objCDO.AttachFile "C:\test.txt"
          Repeat6__index=Repeat6__index+1
              Repeat6__numRows=Repeat6__numRows-1
        rsEQUIPInvoicesAttach.MoveNext
       Wend        
            
objCDO.Send()
Set objCDO = Nothing
Response.Redirect("/menu.asp")

End If
%>
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros