Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1755
  • Last Modified:

Microsoft VBScript runtime error '800a01c2'

Hi
I get this message whenever I click on send in my form mailer.  I'm running an ASP form handler.

Microsoft VBScript runtime error '800a01c2'

Wrong number of arguments or invalid property assignment: 'SendMail'

/formhandler.asp, line 51

Here is my code:
<% Option Explicit %>
<% Response.buffer = true %>
<%
     Dim frmName, frmSurname, frmEmailAddy
     Dim frmPostalAddress, frmCountry, frmOtherCountry
     Dim frmTelephone, frmInterestIn, frmNumberPeople
     Dim frmDayArrive, frmMonthArrive, frmYearArrive
     Dim frmDayDepart, frmMonthDepart, frmYearDepart
     Dim frmComments
         
     frmName = Request.Form("Name")
     frmSurname = Request.Form("Surname")
     frmEmailAddy = Request.Form("Email")
     frmPostalAddress = Request.Form("PostalAddress")
     frmCountry = Request.Form("Country")
     frmOtherCountry = Request.Form("OtherCountry")
     frmTelephone = Request.Form("Telephone")
     frmInterestIn = Request.Form("InterestIn")
     frmNumberPeople = Request.Form("NumberPeople")
     frmDayArrive = Request.Form("DayArrive")
     frmMonthArrive = Request.Form("MonthArrive")
     frmYearArrive = Request.Form("YearArrive")
     frmDayDepart = Request.Form("DayDepart")
     frmMonthDepart = Request.Form("MonthDepart")
     frmYearDepart = Request.Form("YearDepart")
     frmComments = Request.Form("Comments")
     
     Dim emailBody
     
     emailBody = emailBody & "Name:" & frmName & vbCrLf
     emailBody = emailBody & "Surname:" & frmSurname & vbCrLf
     emailBody = emailBody & "Email:" & frmEmailAddy & vbCrLf
     emailBody = emailBody & vbCrLf
     emailBody = emailBody & "PostalAddress:" & frmPostalAddress & vbCrLf
     emailBody = emailBody & "Country:" & frmCountry  & vbCrLf
     emailBody = emailBody & "OtherCountry:" & frmOtherCountry & vbCrLf
     emailBody = emailBody & "Telephone:" & frmTelephone & vbCrLf
     emailBody = emailBody & "InterestIn:" & frmInterestIn & vbCrLf
     emailBody = emailBody & "NumberPeople:" & frmNumberPeople & vbCrLf
     emailBody = emailBody & "DayArrive:" & frmDayArrive & vbCrLf
     emailBody = emailBody & "MonthArrive:" & frmMonthArrive & vbCrLf
     emailBody = emailBody & "YearArrive:" & frmYearArrive & vbCrLf
     emailBody = emailBody & "DayDepart:" & frmDayDepart & vbCrLf
     emailBody = emailBody & "MonthDepart:" & frmMonthDepart & vbCrLf
     emailBody = emailBody & "YearDepart:" & frmYearDepart & vbCrLf
     emailBody = emailBody &  "Comments:" & frmComments & vbCrLf    
     
     'Response.Write("<TEXTAREA cols=80 rows=60>" & emailBody & "</TEXTAREA>")
     'Response.End
         
     SendMail frmEmailAddy, "martiniq@intekom.co.za, leanne@agnet.co.za", emailBody, 1
     Sub SendMail(sender, recipient, subject, body, importance)
     Response.Clear
     Response.Redirect("http://www.marina-martinique.co.za/thanks.htm")
     Dim mail
Set mail = CreateObject("CDONTS.NewMail")
     mail.MailFormat = 0     ' Mime
     mail.From = sender
     mail.To = recipient
     mail.Subject = subject
     mail.Body = body
     mail.Importance = importance
     mail.Send
     Set mail = Nothing
End Sub
%>

I cannot figure this one out. Please help.
0
Didget
Asked:
Didget
2 Solutions
 
AmericanDogmaCommented:
Replace this line:

SendMail frmEmailAddy, "martiniq@intekom.co.za, leanne@agnet.co.za", emailBody, 1

WITH:

SendMail frmEmailAddy,"martiniq@intekom.co.za, leanne@agnet.co.za", SUBJECTVARIABLE, emailBody, 1


Where subject variables is the subject of the email. The sub routine is not receiving the correct number of parameters becuase you forgot to include the subject when you call the parameter and the subroutine is anticipatign that the subject is being pasted
0
 
webwomanCommented:
Move the response.clear and response.redirect to the LAST lines.

You also have no variables called sender, recipient, subject, body or importance. That's what the problem is.

Of course, unless you move those response.clear and response.redirect lines, nothing will be sent anyway.
0
 
AmericanDogmaCommented:
webwoman the sub routine is being called just above the response.clear and response.redirect therfore the sub is called and then the response.cleared and redirected

The varibales you list do exist even though they were never declared. becuase they werent declared outsid eof the subroutine they are private not public variables which is fine.

Diget once again the error you are having is that there are not enoguh parameters beign passed to the subroutine. Your subroutien call needs to be reformed as:

SendMail frmEmailAddy,"martiniq@intekom.co.za, leanne@agnet.co.za", SUBJECTVARIABLE, emailBody, 1
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
webwomanCommented:
They have option explicit -- if they want to use a variable, it has to be declared. Not only are they NOT declared, they're never given any values.

If they're declared/set outside of the code posted, that was NOT specified.

They're not creating the mail object until AFTER the response.redirect. You can't send something if it never gets created.

And the error being generated has to do with the function, and the fact that the variables are NOT declared or set.
>>Wrong number of arguments or invalid property assignment: 'SendMail'
0
 
DidgetAuthor Commented:
Hi
when I put in SUBJECTVARIABLE, without any other changes I get this message:
Microsoft VBScript runtime error '800a01f4'

Variable is undefined: 'SUBJECTVARIABLE'

/formhandler.asp, line 51

I'm a bit confused about webwoman's comments. How would I apply this? Thanks for your help!
0
 
AmericanDogmaCommented:
You need to declare the subjectvarioable using

DIM subjectvariable

Also you should be sure to set the subjectvariabel to whatever your email subject is like:

subjectvariable = "here is my emails subject"

You also need to do that for the emailBody variable l;ike:

emailbody = "This is my email body"

0
 
webwomanCommented:
Frankly, I would get rid of the subroutine -- it's completely unnecessary.

After you load all the variables, I'd do this...

    Dim mail
Set mail = CreateObject("CDONTS.NewMail")
    mail.MailFormat = 0     ' Mime
    mail.From = frmEmailAddy
    mail.To = recipient (who IS this going to?)
    mail.Subject = subject (what do you want to use?)
    mail.Body = emailBody
    mail.Importance = importance (look it up -- I think it's a number)
    mail.Send
    Set mail = Nothing

Then the response.redirect

It's not clear who it's going to, what the subject should be, or how you're setting the importance. If you want those email addresses to be the TO, they need to be separated with a SEMICOLON, not a comma, and you never DO have a subject.
0
 
COBOLdinosaurCommented:
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

<note>
Unless it is clear to me that the question has been answered I will recommend delete.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp


Cd&

0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now