**EDIT:** I know you should never trust client side... My question is what can I use to validate since at the current moment I'm expecting three parameters two of which rely on the client side form (registration email, and email message)

I'm probably going about this the wrong way but it seems like Ajax isn't very secure (well duh..It's client side..) How would you go about creating a function so it cannot be called Via the console by intruders?

So let's say I have a function called SendMail that accepts the to,message and from parameters in which it sends an ajax request to the code behind to send the email.

what can I add that would prevent you from opening the console, recreating my function (except with literal variables ) and executing it via the console? 

Code Behind:

```
<WebMethod()> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json)>
Public Shared Sub sendMail(subject As String, userEmail As String(), message As String)
    Dim fromEmail As String = "supah@domain.com"
    Dim fromAbrv As String = "hidden Tiger"
    Try
        Dim mail As New MailMessage()
        Dim smtp As New SmtpClient("server.domain")
        mail.From = New MailAddress(fromEmail, fromAbrv)
        For i As Integer = 0 To userEmail.Length - 1
            mail.[To].Add(userEmail(i))
        Next
        mail.Subject = subject
        mail.Body = message
        mail.IsBodyHtml = True
        smtp.Send(mail)
    Catch exc As Exception
        Throw exc
    End Try

End Sub

```