SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 27
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Location
    Mission, B.C. Canada
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help with ASP code

    Hello, this code doesn't send the mail, can you see the problem?
    Our test sends the message:
    503 must have sender and recipient first


    Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
    Mailer.FromName = ""& Request("Name") &""
    Mailer.FromAddress = ""& Request("Email") &""
    Mailer.AddRecipient "Upper Village Market Customer Order", "marie@that70sgirl.com"
    strMailHost = "mail.webrothers.com"
    Mailer.RemoteHost = strMailHost


    Mailer.ReturnReceipt = false
    Mailer.ConfirmRead = false

    Mailer.Subject = "**CUSTOMER ORDER**"

    and then the message blah blah blah

    Mailer.Timeout = 30
    Mailer.SendMail

    here is our little test that returned the message above:

    rem SendMail returns a true or false
    rem test for Send Mail
    if Mailer.SendMail then
    Response.Write "Mail sent..."
    else
    Response.Write "Error<br>"
    Response.Write Mailer.Response
    end if

    Thanks in advance
    Marie
    Last edited by marie70; Oct 2, 2001 at 11:08.

  2. #2
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's the code that should work:

    [code]Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
    Mailer.FromName = Request("Name")
    Mailer.FromAddress = Request("Email")
    Mailer.AddRecipient "Upper Village Market Customer Order", "marie@that70sgirl.com"
    strMailHost = "mail.webrothers.com"
    Mailer.RemoteHost = strMailHost


    Mailer.ReturnReceipt = false
    Mailer.ConfirmRead = false

    Mailer.Subject = "**CUSTOMER ORDER**"

    and then the message blah blah blah (<--supposed to be there?)

    Mailer.Timeout = 30
    Mailer.SendMail

    here is our little test that returned the message above:
    if Mailer.SendMail then
    Response.Write "Mail sent..."
    else
    Response.Write "Error<br>"
    Response.Write Mailer.Response
    end if

    Thanks in advance
    Marie


    Last edited by marie70 on 02-Oct-2001 at 01
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Location
    Mission, B.C. Canada
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for replying, no that red code isn't supposed to be there, I just have a lot of other stuff in there (the blah blah blah). I tried making the changes you suggested, but it still seems to work the same way because I still get the message:
    503 must have sender and recipient first

    Any other thoughts?

  4. #4
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Avoid using Request(), use Request.QueryString() or Request.Form() as needed. Also, make sure you have the AddRecipient parameters in the correct order, most email COMs use the following syntax:

    Mailer.AddRecipient( strEmail, strName )

    Try this code and see what it does for you (assuming your mailer is using the form POST method).

    Code:
    Set Mailer = Server.CreateObject( "SMTPsvg.Mailer" )
    Mailer.FromName = Request.Form( "Name" )
    Mailer.FromAddress = Request.Form( "Email" )
    Mailer.AddRecipient "Upper Village Market Customer Order", "marie@that70sgirl.com" 
    Mailer.RemoteHost = "mail.webrothers.com"
    Mailer.ReturnReceipt = False 
    Mailer.ConfirmRead = False 
    Mailer.TimeOut = 30
    Mailer.Subject = "** Customer Order **"
    Response.Write( Mailer.SendMail )
    <sidenote>In the code you posted, you are actually sending
    the email twice, as you call Mailer.SendMail 2 times, once
    to send and once to check for errors.</sidenote>
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  5. #5
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: help with ASP code

    Originally posted by marie70
    ""& Request("Name") &""
    Where is this coming from?! I've seen it a few times here at SitePoint? Is is from a book?

  6. #6
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Request is a collection, and .cookies and .form and .querystring are sub collections...

    So you can just look in all collections if you so desire but it's both inefficient and sloppy.

    I THINK, but I'm not sure

    btw, way to go on the How Do YOU threads, keep up the work and participation will increase, don't get discouraged If we have like NO replies after a month we'll stop it
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  7. #7
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, so I made myself look like an idiot,

    What i was talking about was the ' "" & '

    Sunny, the request("blah") is ok, its not really sloppy or inefficient, just that it leave it open to causing errors. Mainly it could request it from the wrong thing, ie, form instead of cookie, etc. etc.

    the Request is called an object, binaryRead is called a method, totalBytes is a property and clientcertificate, cookies, form, querystring, and servervariables are called collections.

    Just thought I'd clear that up for you

  8. #8
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Cleared up

    "its not really sloppy or inefficient, just that it leave it open to causing errors"

    That's sloppy and inefficient to me
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  9. #9
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, whatever you do, don't look too closely at the search scripts I've supplied you with, lol


  10. #10
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    By restricting the form method, you can also keep lamers from using your scripts for things that they were not intended for, particuarly mail scripts. By forcing the POST method, you eliminate 1/2 the lamers because they don't understand the way HTTP works, and don't know how to spoof headers. The sad part about this is that most web "developers" don't have a clue about the protocols they use either. Most of my form handling scripts will require POST and log any attempts made to use GET, and if the user persists in using GET, they are banned (by IP) from the server.

    <mischief>I just LOVE finding unprotected mailer scripts. It gives me
    great pleasure to teach people a lesson by putting their server on it's knees.</mischief>
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  11. #11
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lol kode, I think you'ev got too much free time on your hands

  12. #12
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    LOL, free time??? AS IF!

    I just copy/paste the URL for the script in my little application and hit the "BOMB!" button. It will keep sending until A) the server doesn't respond, or B) I turn it off.

    The whole process takes me an entire 5 seconds, after that, I turn around back to my workstation and get back to work.

    Sure, it is overkill, but you can understand my point, I am sure. I do it to help server admins learn a lesson, not too harm the server. Other people may not be so nice. For example, the 9 people that are CONSTANTLY trying to DoS my mail servers. Too bad all they get from my servers is "Connection DENY on port 25". All the lamers have succeeded in doing is filling up my security logs a little faster.
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  13. #13
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Location
    Mission, B.C. Canada
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I tried what you said KodeKrash

    I used Request.Cookies instead of just Request. It didn't seem to make any difference. I'm not sure which goes first in Mailer.AddRecipient, first you said try the e-mail first, but your code has it second? Neither works in any case. With the
    Response.Write( Mailer.SendMail )
    at the end it goes to a new page and says FALSE.

    Any other suggestions would be GREATLY appreciated!

    Thanks so much

  14. #14
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried any other Email components ?

    You might try MailMonger as it will tell you what email COMs your server supports.
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  15. #15
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Location
    Mission, B.C. Canada
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OKey Dokey I'll check it out, thanks

  16. #16
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm, better yet, try CDONTS, since it should be installed by default on your server (if it is NT). If not, well then your host has a problem...so easy to use and easy to install on the server.

    and D' wrote a tutorial on it. Which rocks. I just have to make it 'sitepointable'.

    (PS D', i need that tutorial again! PM plaintext works really well, i'll take care of the formatting.)

    Hope you'll consider CDONTS.
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  17. #17
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    MailMonger supports CDONTS (and 9 other major email COMs), and it has a function to tell you which one IS installed on the server. If you ever move the site to a host that doesn't support the email component you setup in your MailMonger controller, you just change it by setting objMail.Provider = xx, you don't have to go chase down all the different places you have mailer functions.

    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  18. #18
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Location
    Mission, B.C. Canada
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    alright, I tried the MailMonger and I do have CDONTS on this server, do I only have to change this line of code then?
    Set Mailer = Server.CreateObject("SMTPsvg.Mailer")

    Or should I wait for that tutorial?

    Thanks again

  19. #19
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The CDONTS tutorial? If you look at my signature, there is a link

  20. #20
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Location
    Mission, B.C. Canada
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OH well that IS handy, thanks you are a super peach!

  21. #21
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It sounds like you have it wrapped up with CDONTS, so I will shut up about MailMonger.
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  22. #22
    SitePoint Zealot
    Join Date
    Jun 2001
    Location
    Jakarta
    Posts
    156
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    About CDONTS, how we specify the sender's name or recipient's name ? As far as I know, CONTS only use sender's email and recipient's email.

  23. #23
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess I should have added that into the tutorial, it would look like this:

    Code:
    objEmail.to = """Chris Canal"" <dhtmlgod@hotmail.con>"
    objDmail.From = """Joe Smith"" <joe@blahblah.com>"

  24. #24
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Revisions are an excellent Idea, D'.
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  25. #25
    SitePoint Zealot
    Join Date
    Jun 2001
    Location
    Jakarta
    Posts
    156
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm using ASP for CDONTS, so usually I do thing like this :
    fname = Request("fname")
    femail = Request("femail")
    tname = Request("tname")
    temail = Request("temail")

    objMail.To = temail
    objMail.From = femail

    Last time I try this :
    objMail.To = tname & temail
    objMail.From = fname & femail

    There is no error, but no message was sent.
    Can you explain to me, why there are many " and before email address, is there must be a space ?
    Last edited by jet_wang; Oct 4, 2001 at 20:17.


Bookmarks

Posting Permissions

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