Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

Auto send a CDO e-mail on page load

Posted 13 Jul 2002 00:18:31
1
has voted
13 Jul 2002 00:18:31 Mitchel Tendler posted:
I created a form to let people enter in change requests. Depending on the change request type, a certain person will address the request.

I have a table in Access that has the types of change requests and the e-mails associated with them.

When the form is submitted it takes them to another page, that page also has a form and all of the values are already filled in from the last form, and the TO EMAIL is also filled in because I have a RS to deteremine which e-mail to use.

When I click the SUBMIT button, everything works fine and the e-mail is sent, what I want to do is avoid having the person click the submit button, I want the e-mail to be automatically sent off when the page is loaded and have the code redirect them to the Thank You page.

How can I make the form submit automatically?

Edited by - mitchelt on 13 Jul 2002 00:19:18

Replies

Replied 13 Jul 2002 10:29:49
13 Jul 2002 10:29:49 Dave Clarke replied:
If I am reading you correctly the second page is just there to send the mail? all details by the user ae filled in on the first page?
If this is so, then all you have to do is put the code for sending the mail above the <head></head> tags and then in the <head></head> tags put an onload gotoURL behaviour pointing to your thank you page, then the second page will send the mail and redirect without even showing up to your user.

hope that helps

Dave
Replied 13 Jul 2002 17:21:08
13 Jul 2002 17:21:08 aegis kleais replied:
Just paste the following page code on the page. It'll execute onload.

<%
Option Explicit
Dim myMail
Set myMail = Server.CreateObject("CDONTS.NewMail"
myMail.Send "fromEmailAddress", "toEmailAddress", "subjectTitle", "messageContent", 0
Set myMail = Nothing
%>

-----------------------------------

The number on the end of the line:

0 = low priority
1 = medium priority
2 = high priority
3 = no such thing, this'll give you an error becuause you can't go higher than 2. I just wanted to add something funny and/or stupid.

Aegis Kleais
New Media Web Developer
(DWMX : IIS5.1 : SQL2K : WXP : ASP[VB/JS])

Reply to this topic