PDA

View Full Version : Sending an email from Insert Record


thinkdolphin
01-22-2010, 08:14 PM
Can anyone tell me what to do to send an email with info from the Insert Record form to an email address? But JUST certain fields, not the whole form so there will be exclusions.

Here is the generated code:

<!--#include file="../Connections/Comm_Choice.asp" -->
<%
// *** Edit Operations: declare variables
// set the form action variable
var MM_editAction = Request.ServerVariables("SCRIPT_NAME");
if (Request.QueryString) {
MM_editAction += "?" + Server.HTMLEncode(Request.QueryString);
}
// boolean to abort record edit
var MM_abortEdit = false;
%>
<%
if (String(Request("MM_insert")) == "form1") {
if (!MM_abortEdit) {
// execute the insert

var MM_editCmd = Server.CreateObject ("ADODB.Command");
MM_editCmd.ActiveConnection = MM_Comm_Choice_STRING;
MM_editCmd.CommandText = "INSERT INTO Entertainment (All_Around, Bagels, Bakery, Bar, BBQ, Beer, Bingo, Breakfast, Brunch, Buffet, Burger, Cake, Candy, Chicken, Chinese, Coffee_Shop, Cookies, Comedy, Coffee_Cup, Dance, Deli, Delivery, Dessert, Dinner, Dinner_10, Donuts, Fast_Food, Fastest_Lunch, Happy_Hour, Healthy_Food, Hoagie, Hotdog, Ice_Cream, Italian, Japanese, Lunch_Delivered, Lunch_Spot, Mediterranean, Mexican, Night_Spot, Pizza_Chain, Pizza_Nonchain, Rest_Atmosphere, Ribs, Romantic, Spaghetti, Sports_Bar, Steakhouse, Wings, Your_Name, Your_Address, Your_City, Your_State, Your_Phone, Your_Email, Your_Age, Subscriber) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
MM_editCmd.Prepared = true;
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param1", 202, 1, 255, Request.Form("All_Around"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param2", 202, 1, 255, Request.Form("Bagels"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param3", 202, 1, 255, Request.Form("Bakery"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param4", 202, 1, 255, Request.Form("Bar"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param5", 202, 1, 255, Request.Form("BBQ"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param6", 202, 1, 255, Request.Form("Beer"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param7", 202, 1, 255, Request.Form("Bingo"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param8", 202, 1, 255, Request.Form("Breakfast"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param9", 202, 1, 255, Request.Form("Brunch"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param10", 202, 1, 255, Request.Form("Buffet"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param11", 202, 1, 255, Request.Form("Burger"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param12", 202, 1, 255, Request.Form("Cake"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param13", 202, 1, 255, Request.Form("Candy"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param14", 202, 1, 255, Request.Form("Chicken"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param15", 202, 1, 255, Request.Form("Chinese"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param16", 202, 1, 255, Request.Form("Coffee_Shop"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param17", 202, 1, 255, Request.Form("Cookies"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param18", 202, 1, 255, Request.Form("Comedy"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param19", 202, 1, 255, Request.Form("Coffee_Cup"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param20", 202, 1, 255, Request.Form("Dance"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param21", 202, 1, 255, Request.Form("Deli"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param22", 202, 1, 255, Request.Form("Delivery"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param23", 202, 1, 255, Request.Form("Dessert"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param24", 202, 1, 255, Request.Form("Dinner"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param25", 202, 1, 255, Request.Form("Dinner_10"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param26", 202, 1, 255, Request.Form("Donuts"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param27", 202, 1, 255, Request.Form("Fast_Food"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param28", 202, 1, 255, Request.Form("Fastest_Lunch"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param29", 202, 1, 255, Request.Form("Happy_Hour"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param30", 202, 1, 255, Request.Form("Healthy_Food"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param31", 202, 1, 255, Request.Form("Hoagie"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param32", 202, 1, 255, Request.Form("Hotdog"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param33", 202, 1, 255, Request.Form("Ice_Cream"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param34", 202, 1, 255, Request.Form("Italian"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param35", 202, 1, 255, Request.Form("Japanese"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param36", 202, 1, 255, Request.Form("Lunch_Delivered"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param37", 202, 1, 255, Request.Form("Lunch_Spot"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param38", 202, 1, 255, Request.Form("Mediterranean"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param39", 202, 1, 255, Request.Form("Mexican"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param40", 202, 1, 255, Request.Form("Night_Spot"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param41", 202, 1, 255, Request.Form("Pizza_Chain"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param42", 202, 1, 255, Request.Form("Pizza_Nonchain"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param43", 202, 1, 255, Request.Form("Rest_Atmosphere"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param44", 202, 1, 255, Request.Form("Ribs"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param45", 202, 1, 255, Request.Form("Romantic"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param46", 202, 1, 255, Request.Form("Spaghetti"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param47", 202, 1, 255, Request.Form("Sports_Bar"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param48", 202, 1, 255, Request.Form("Steakhouse"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param49", 202, 1, 255, Request.Form("Wings"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param50", 202, 1, 255, Request.Form("Your_Name"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param51", 202, 1, 255, Request.Form("Your_Address"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param52", 202, 1, 255, Request.Form("Your_City"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param53", 202, 1, 255, Request.Form("Your_State"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param54", 202, 1, 255, Request.Form("Your_Phone"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param55", 202, 1, 255, Request.Form("Your_Email"))); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param56", 5, 1, -1, (String(Request.Form("Your_Age")) != "undefined" && String(Request.Form("Your_Age")) != "") ? Request.Form("Your_Age") : null)); // adDouble
MM_editCmd.Parameters.Append(MM_editCmd.CreatePara meter("param57", 202, 1, 255, Request.Form("Subscriber"))); // adVarWChar
MM_editCmd.Execute();
MM_editCmd.ActiveConnection.Close();
// append the query string to the redirect URL
var MM_editRedirectUrl = "thankyou.html";
if (MM_editRedirectUrl && Request.QueryString && Request.QueryString.Count > 0) {
MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1) ? "?" : "&") + Request.QueryString;
}
Response.Redirect(MM_editRedirectUrl)
}
}
%>

TIA!
Dahn

edbr
07-07-2010, 02:19 AM
i dont know my ASP from my elbow, but you will need a mail sending script . you will have to yahoogle for one i imagine

gigiloumill
08-17-2010, 01:57 PM
Search for a mailing script and leave the fields you don't want out.