Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFMail Errors

Status
Not open for further replies.

HashMan007

IS-IT--Management
Joined
Jun 3, 2002
Messages
4
Location
US
Hi everybody;
I am trying to send out a bulk email using CF and access database. I have created a form where I can type my subject and message and when I click on send it should send messages to all the people in the database with email address. I am able to send out emails with now problems when I manually fill in the subject and the body portion of the message, but I get errors when it tell it to use:

"#Form.Subject#"
#Form.Message#. The error message follows my code. Please Help.

-----CODE-----
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>
<form name=&quot;form&quot; method=&quot;post&quot; action=&quot;&quot;>
<table width=&quot;75%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;2&quot;>
<tr>
<td width=&quot;4%&quot;> </td>
<td width=&quot;13%&quot;><strong><font size=&quot;2&quot; face=&quot;Verdana, Arial, Helvetica, sans-serif&quot;>Subject:</font></strong></td>
<td width=&quot;83%&quot;><input name=&quot;Subject&quot; type=&quot;text&quot; id=&quot;Subject&quot;></td>
</tr>
<tr>
<td> </td>
<td><strong><font size=&quot;2&quot; face=&quot;Verdana, Arial, Helvetica, sans-serif&quot;>Message</font></strong></td>
<td><textarea name=&quot;Message&quot; cols=&quot;60&quot; rows=&quot;10&quot; id=&quot;Message&quot;></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;SEND!&quot;></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</form>
</body>
</html>
<cfquery name=&quot;get_email&quot; datasource=&quot;Unique_support&quot; dbtype=&quot;ODBC&quot;>
SELECT *
FROM support
WHERE email > '0'</cfquery>
<cfmail to=&quot;#email#&quot; from=&quot;info@hc.net&quot; subject=&quot;#Form.Subject#&quot; query=&quot;get_email&quot;>
</cfmail>


---ERROR----
Error Diagnostic Information
SUBJECT

The attribute value is an invalid expression: An error has occurred while processing the expression:

#Form.Subject#



Error near line 1, column 3.


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

Error resolving parameter FORM.SUBJECT


The specified form field cannot be found. This problem is very likely due to the fact that you have misspelled the form field name.



The error occurred while processing an element with a general identifier of (CFMAIL), occupying document position (36:1) to (36:101).


Date/Time: 06/16/02 16:40:03
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

 
You have got a form that does not submit to anything. what you need to do is to sumit the form to another page or the same one and check for a submission, but for ease it is easier to submit to another page for now.

your form should look like this:

<form name=&quot;form&quot; method=&quot;post&quot; action=&quot;yoursecondpage.cfm&quot;>
<!---rest of the form elements here without the query or cfmail tag --->
</form>

now on you second page you can put your cfquery and your cfmail tag as they are and this should then work.

so your second page will look like

<!--- start of second page --->
<cfquery name=&quot;get_email&quot; datasource=&quot;Unique_support&quot; dbtype=&quot;ODBC&quot;>
SELECT *
FROM support
WHERE email > '0'
</cfquery>

<cfmail to=&quot;#email#&quot; from=&quot;info@hc.net&quot; subject=&quot;#Form.Subject#&quot; query=&quot;get_email&quot;>
</cfmail>

<!--- end of second page --->

the reason that this worked before when it was hardcoded was because it was not looking for variables that were defined in code/form submission, because you then moved to supply that information via a form this is what broke it

hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top