If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > SMTP problems

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-19-02, 02:23
John316 John316 is offline
Registered User
 
Join Date: Sep 2002
Posts: 68
Smile 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
Reply With Quote
  #2 (permalink)  
Old 09-19-02, 06:25
JonathanB JonathanB is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 09-19-02, 08:44
Mulligan Mulligan is offline
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old 09-19-02, 10:42
John316 John316 is offline
Registered User
 
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

Quote:
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.
Reply With Quote
  #5 (permalink)  
Old 09-19-02, 10:49
Mulligan Mulligan is offline
Registered User
 
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>
Reply With Quote
  #6 (permalink)  
Old 09-19-02, 12:54
John316 John316 is offline
Registered User
 
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

Quote:
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>
Reply With Quote
  #7 (permalink)  
Old 09-19-02, 13:06
John316 John316 is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On