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.ht m"-->
<!--#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("MailBo dy") &"<html><p> </p><p><a href='http://"&Request.ServerVari ables("SER VER_NAME") &"/emailUn Subscribe. asp'>Click Here</a> to Un-Subscribe</html>"
' Send Attachment
Dim objMessage
Set objMessage = Server.CreateObject("CDONT S.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("/NewsLette rs/" & 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>
thank you!
<html>
<!--#include virtual="/public_includes/
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<!--#include virtual="/public_includes/
</head>
<!--#include virtual="/public_includes/
<!--#include virtual="/public_includes/
<!--#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("MailBo
' Send Attachment
Dim objMessage
Set objMessage = Server.CreateObject("CDONT
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("/NewsLette
' 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/
</html>
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.
ASKER
it said error code 5
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.