?
Solved

Invalid procedure call or argument

Posted on 2007-10-05
4
Medium Priority
?
948 Views
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!

<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>
0
Comment
Question by:Platini
  • 3
4 Comments
 
LVL 30

Expert Comment

by:third
ID: 20027384
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.
0
 
LVL 30

Expert Comment

by:third
ID: 20027387
i mean error line number.
0
 

Author Comment

by:Platini
ID: 20027540
it said error code 5
0
 
LVL 30

Accepted Solution

by:
third earned 2000 total points
ID: 20028774
that error code doesn't help that much. I guess you have a problem on sending emails. try to replace your code with this below,


Set objMessage = Server.CreateObject("CDO.Message")

With objMessage
      ' Set message attributes
      .To       = "irap@irs.gov"
      .From     = "IRAP_Intranet"
      .BCC        = toStr
      .Subject  = "IRAP Connection Newsletter"
      .HTMLBody = body

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

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

      .Send
End With
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month16 days, 8 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question