Results 1 to 6 of 6

Thread: ASP Subs/functions - please

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Angry ASP Subs/functions - please

    Hello,

    How do you declare a function/sub in ASP (NOT VBScript....).
    I want to do something like

    onclick="email()"
    < script language="VBScript">
    sub email
    Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
    mailer.fromname = "TEST"
    mailer.fromaddress = "myemail.com"
    Mailer.RemoteHost = "myremotehost.net"
    mailer.addrecipient "Test","YourAddress.com"
    mailer.subject = "Testing"
    mailer.bodytext = "Hello"
    end sub


    I get errors like "Server not an object" and "mailer not an object".

    Thanks,
    T

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    Code:
    onclick="email()" 
    < script language="VBScript"> 
    Sub Emailer()
         set mailer = Server.CreateObject("SMTPsvg.Mailer")  
         mailer.fromname = "TEST" 
         mailer.fromaddress = "myemail.com" 
         mailer.RemoteHost = "myremotehost.net" 
         mailer.addrecipient "Test","YourAddress.com" 
         mailer.subject = "Testing" 
         mailer.bodytext = "Hello" 
    end sub
    make sure you have the smtpsvg dlls on the server ect..

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343
    Thanks kovan,

    Why do I get the error "mailer not an object" (or something like that). Is the code in VBScript the same as ASP?? (Most probably a stupid question...??!!)

    How do I do a response.write within this function. I got an error when trying to do a response.write.

    I'm just used to writting all my code withing the <% %> tags - never used "< script language="VBScript"> "

    thanks,
    T

  4. #4
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    using <% %> is same thing as writing script.....

    as far as i know
    i never use the script tag
    just <%

    use <% instead
    and use response.write...

    why are you getting an error?
    i dont know what type of emailer your making
    but it seems that it cant create the object

    try the generic emailer object..

  5. #5
    New Member
    Join Date
    Feb 2001
    Posts
    12
    looks like you are trying to set the object on the actual page itself so when something is clicked it sends the email, as far as I know, you cant do that
    the code to send the email needs to be in between <% %> tags and not on the same page as the thing thats clicked
    best way would be use a form then when the form is submitted send the email and then show some html saying well done its been sent etc.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Talking Thanks guys!!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width