Results 1 to 7 of 7

Thread: SMTP problems

  1. #1
    Join Date
    Sep 2002
    Posts
    68

    Smile Unanswered: SMTP problems

    Hi all,

    I have created a web ordering form. My question is I am trying to create 2 buttons. On my admin side.

    Button One) If the admin clicks this button it will shot off an email to another admin for shipping.

    Button Two) If the admin rejects the order this button will need to send an email to a different admin.

    So how do I send email to two different email address on the same form?


    Thanks,
    John316

  2. #2
    Join Date
    Feb 2002
    Location
    North Wales, UK
    Posts
    114
    In the past I've used JavaScript to perform that task... although you can acheive your aim by just turning the two buttons into normal links providing you don't need to send any form data to the e-mail script.
    J^ - web | email
    newsASP Developer

  3. #3
    Join Date
    Jul 2002
    Posts
    55
    Make both the buttons submit buttons, name one "accept" and one "reject". When you POST the form, you can do something like:
    Code:
    If Request.Form("accept").Count <> 0 Then
       ' Send acceptance email to admin for shipping
    ElseIf Request.Form("reject").Count <> 0 Then
       ' Send the other email
    Else
       ' Throw an error
    End If
    Use CDO (Collaboration Data Objects) to create and send the emails.

    Mull.

  4. #4
    Join Date
    Sep 2002
    Posts
    68

    CDO Issue

    How do I add your code to my CDO? My CDO is listed below:

    <%
    ' Else
    ' Response.Write "Cannot page out! Code: " & mailer.ErrorString
    ' End If
    Set mailer=Nothing
    %>
    <%
    Dim objNewMail
    Set objNewMail = Server.CreateObject("CDONTS.NewMail")
    %>
    <%

    ' First create an instance of NewMail Object
    Set objNewMail = Server.CreateObject("CDONTS.NewMail")
    objNewMail.From = Request.Form("User_email")
    objNewMail.To = "test.admin@sample.com"

    objNewMail.Subject = "Order Request. <automated message>"
    objNewMail.Body = "This is just a test."

    objNewMail.Send
    Set objNewMail = Nothing

    %>

    Thanks,
    John316

    Originally posted by Mulligan
    Make both the buttons submit buttons, name one "accept" and one "reject". When you POST the form, you can do something like:
    Code:
    If Request.Form("accept").Count <> 0 Then
       ' Send acceptance email to admin for shipping
    ElseIf Request.Form("reject").Count <> 0 Then
       ' Send the other email
    Else
       ' Throw an error
    End If
    Use CDO (Collaboration Data Objects) to create and send the emails.

    Mull.

  5. #5
    Join Date
    Jul 2002
    Posts
    55
    Try something like this. Cut down for size. The form submits to itself (well, its own page) and the top of the page checks for which button has been pressed. Based on that, we send to one email address or the other.
    Code:
    <%
    
    Dim accepting
    Dim rejecting
    
    accepting = Request.Form("accept").Count <> 0
    rejecting = Request.Form("reject").Count <> 0
    
    If accepting Then
    
    	Dim objNewMail
    	Set objNewMail = Server.CreateObject("CDONTS.NewMail")
    
    	' First create an instance of NewMail Object
    	Set objNewMail = Server.CreateObject("CDONTS.NewMail")
    	objNewMail.From = Request.Form("User_email")
    	objNewMail.To = "test.admin@sample.com"
    
    	objNewMail.Subject = "Order Request. <automated message>"
    	objNewMail.Body = "This is just a test."
    
    	objNewMail.Send
    	Set objNewMail = Nothing
    	
    ElseIf rejecting Then
    
    	' CDO to rejected email address
    
    End If
    %>
    <form name="mailer" action="thispage.asp" method="post">
    <input type="submit" name="accept" value="Accept" />
    <input type="submit" name="reject" value="Reject" />
    </form>

  6. #6
    Join Date
    Sep 2002
    Posts
    68

    Your Code Did Not.......

    I tried you code and it did not send an email. Is there something else I could try?

    John316

    Originally posted by Mulligan
    Try something like this. Cut down for size. The form submits to itself (well, its own page) and the top of the page checks for which button has been pressed. Based on that, we send to one email address or the other.
    Code:
    <%
    
    Dim accepting
    Dim rejecting
    
    accepting = Request.Form("accept").Count <> 0
    rejecting = Request.Form("reject").Count <> 0
    
    If accepting Then
    
    	Dim objNewMail
    	Set objNewMail = Server.CreateObject("CDONTS.NewMail")
    
    	' First create an instance of NewMail Object
    	Set objNewMail = Server.CreateObject("CDONTS.NewMail")
    	objNewMail.From = Request.Form("User_email")
    	objNewMail.To = "test.admin@sample.com"
    
    	objNewMail.Subject = "Order Request. <automated message>"
    	objNewMail.Body = "This is just a test."
    
    	objNewMail.Send
    	Set objNewMail = Nothing
    	
    ElseIf rejecting Then
    
    	' CDO to rejected email address
    
    End If
    %>
    <form name="mailer" action="thispage.asp" method="post">
    <input type="submit" name="accept" value="Accept" />
    <input type="submit" name="reject" value="Reject" />
    </form>

  7. #7
    Join Date
    Sep 2002
    Posts
    68

    Re: Your Code Did Not.......

    And since I need to have the .asp form email to different address it will not work your way. That will only email one email address not 2.

    John316

Posting Permissions

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