We help IT Professionals succeed at work.

Invalid procedure call or argument

Platini asked
Last Modified: 2008-06-25
I'm getting this error when I test this code. Can anyone tell me what is the problem here?

thank you!

<!--#include virtual="/public_includes/dbConnect.asp"-->
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<!--#include virtual="/public_includes/javascript_misc.asp"-->
<!--#include virtual="/public_includes/header3.htm"-->
<!--#include virtual="/public_includes/Misc.asp"-->
<!--#include virtual="upload.asp"-->
<body onload="DoLoad()">
On Error resume next
      Dim Uploader, File
      Set Uploader = New FileUploader            
                  ' This starts the upload process
            FileDestination = Server.MapPath("..") & "\NewsLetters"

                  ' This starts the upload process
                  If Uploader.Files.Count <> 0 Then

                  ' Loop through the uploaded files
                        For Each File In Uploader.Files.Items
                              ' Save the file
                              File.SaveToDisk FileDestination
                              ' Get the file name
                              FileName = File.FileName
                        If err.number <> 0 then
                           response.write err.number & " - " & err.description
                        end if
                        'Get email list            
                        q_str =  "SELECT distinct email from tblNLSubscriber"
                        Set rs = oConn.Execute(q_str)  
                        if Not rs.EOF then
                              toStr = ""
                              i = 0
                              do while not rs.eof
                                 i = i + 1
                                 toStr = toStr & rs("email") & ";"
                        end if
                        rs.close ()

body=uploader.form("MailBody") &"<html><p>&nbsp;</p><p><a href='http://"&Request.ServerVariables("SERVER_NAME")&"/emailUnSubscribe.asp'>Click Here</a> to Un-Subscribe</html>"

                        ' Send Attachment                        
                              Dim objMessage

                              Set objMessage = Server.CreateObject("CDONTS.Newmail")

                              With objMessage
                                    ' Set message attributes
                                    .To       = "irap@irs.gov"
                                    .From     = "IRAP_Intranet"
                                    .BCC        = toStr
                                    .Subject  = "IRAP Connection Newsletter"
                                    .MailFormat = 0      '0=Mime format, 1=default plain text format
                                    .BodyFormat = 0      '0=HTML format, 1=default plain text format
                                    .Body = body
'                                    .TextBody = Uploader.form("MailBody")

                                    ' Attachment using known static physical path
                                    '.AddAttachment "c:\somepath\somefile.txt"

                                    ' Attachment using mappath to find the physical path
                                    .AttachFile Server.MapPath("/NewsLetters/" & FileName & "")

                                    ' Attachment added directly from a URL
                                    '.AddAttachment "http://www.asp101.com/samples/images/asp101-100x30.gif"
                              End With

                        Set objMessage = Nothing
                        if err.number <> 0 then
                                 response.write "Error occured.  Newsletter are not being sent.  Please contact the webmaster.<br>"
                                 response.write "Error: " & err.number & " - " & err.description
                                 response.write "Thank you.  The Quarterly News Letter has been sent.<p><a href='webadmin.asp'>Back to Web Admin page</a>"
                        end if                        
                        response.write "No Newsletter attached.  Messages are not being sent."
                  End If

set rs = nothing
set oConn = nothing

<!--#include virtual="/public_includes/footer.htm"-->
Watch Question

did the browser told you where the line number of the error is? try commenting 'On Error resume next' first, the line number will give you a hint.

i mean error line number.


it said error code 5
Unlock this solution and get a sample of our free trial.
(No credit card required)

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.