Link to home
Start Free TrialLog in
Avatar of Platini
Platini

asked on

Invalid procedure call or argument

I'm getting this error when I test this code. Can anyone tell me what is the problem here?

thank you!

<html>
<!--#include virtual="/public_includes/dbConnect.asp"-->
<head>
<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"-->
</head>
<!--#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
                  Uploader.Upload()
      
            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
                        Next
                        If err.number <> 0 then
                           response.write err.number & " - " & err.description
                           response.end
                        end if
                        'Get email list            
                        q_str =  "SELECT distinct email from tblNLSubscriber"
                        Set rs = oConn.Execute(q_str)  
                        
                        rs.moveFirst
                        if Not rs.EOF then
                              toStr = ""
                              i = 0
                              do while not rs.eof
                                 i = i + 1
                                 toStr = toStr & rs("email") & ";"
                                 rs.moveNext
                              loop
                        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"
      
                                    .Send
                              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
                        else
                                 response.write "Thank you.  The Quarterly News Letter has been sent.<p><a href='webadmin.asp'>Back to Web Admin page</a>"
                        end if                        
                  Else
                        response.write "No Newsletter attached.  Messages are not being sent."
                  End If

                                                                                                                                    
oConn.close
set rs = nothing
set oConn = nothing



%>
</body>
<!--#include virtual="/public_includes/footer.htm"-->
</html>
Avatar of third
third
Flag of Philippines image

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.
Avatar of Platini
Platini

ASKER

it said error code 5
ASKER CERTIFIED SOLUTION
Avatar of third
third
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial