Forums

This topic is locked

HELP PLEASE - FORUM

Posted 15 May 2004 01:51:06
1
has voted
15 May 2004 01:51:06 Winston Krauss posted:
Hello,
I made a page that has a form that adds a record into my database, then after the record is added, an e-mail will be sent using the following code. This code is contained in the same page with the forum to add the record.

<%
Set objNewMail = Server.CreateObject("CDONTS.NewMail"
objNewMail.From = " "
objNewMail.Subject = "Update Notification"
objNewMail.To = " "
objNewMail.Body = "User, " & VBCrLf & "User " & (rsLogin.Fields.Item("Name".Value) & " has added a class. " & VBCrLf & "The following information was inserted into the database. " & VBCrLf & " " & VBCrLf & "Class Title: " & <u>Request.Form("ClassName"</u> & " "
objNewMail.Send
Set objNewMail = Nothing
%&gt;

In the above code, the underlined part, Request.Form("ClassName" , is where i have my problem. That code SHOULD place the data from the field ClassName into the e-mail but when the e-mail is sent that part is blank. I dont know how to set the value of that Form Object there any other way. This is probably confusing but any help would be great.
Thanks,

Replies

Replied 15 May 2004 09:44:37
15 May 2004 09:44:37 Vince Baker replied:
To test the email object without sending it, you should comment out the obNewMail.send line and replace it with:

Response.Write(objNewMail.body)

This will show you what is in theory about to be sent so you can see if the form value is populated.

Personally, to keep things clean I would set a variable before the email code and populate it with the form value also, I would remove a few "" you have that are not needed:

&lt;&lt;% Dim strEmailClass
strEmailClass = Request("ClassName"

Set objNewMail = Server.CreateObject("CDONTS.NewMail"
objNewMail.From = " "
objNewMail.Subject = "Update Notification"
objNewMail.To = " "
objNewMail.Body = "User, " & VBCrLf & "User " & (rsLogin.Fields.Item("Name".Value) & " has added a class. " & VBCrLf & "The following information was inserted into the database. " & VBCrLf & VBCrLf & "Class Title: " & strEmailClass
objNewMail.Send
Set objNewMail = Nothing
%&gt;

Regards
Vince

DMX Talkzone Manager

Visit my home: www.chez-vince.com

VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 16 May 2004 14:08:11
16 May 2004 14:08:11 Vince Baker replied:
Hi,

I have removed the other post that you have made as it is a duplicate of this one. Please avoid duplicating posts as it wastes time for the volunteers that reply here.



Regards
Vince

DMX Talkzone Manager

Visit my home: www.chez-vince.com

VBScript | ASP | HTML | SQL | Oracle | Hosting

Reply to this topic