Complex object types cannot be converted to simple values.

Hi
Trying to send an email out to a database (testing 2 the first two users in the db) but get the following error. This is urgent & I'm stumped but i know it must be something simple.... CF7.1 on Windows 2000

 "Complex object types cannot be converted to simple values.
The expression has requested a variable or an intermediate expression result as a simple value, however, the result cannot be converted to a simple value. Simple values are strings, numbers, boolean values, and date/time values. Queries, arrays, and COM objects are examples of complex values.

The most likely cause of the error is that you are trying to use a complex value as a simple one. For example, you might be trying to use a query variable in a <CFIF> tag. This was possible in ColdFusion 2.0 but creates an error in later versions."

Code is:

<!--- Send mail --->
<cfquery name="qUsers" datasource="wcff_2006_nz">
      SELECT us.*
      FROM tblUser us
      WHERE userid IN (1,2)
</cfquery>

<!--- <cfquery name="qUsers" datasource="wcff_2006_nz">
      SELECT us.*
      FROM tblUser us
      WHERE us.brandId = 2
      AND userid >= 4150
</cfquery> --->

<cfoutput query="#qUsers#">

<cfmail from="info@mysite.com" to="#qUsers.email#" subject="Virtual Footy Invite - Win a $1199 Canon photo printer" type="html">
<STYLE>
.text  {
      font-size : 11px;
      font-family : Verdana, Arial;
      line-height : 14px;
      color: ##152255;
      text-align : left justify;
}
.smalltext  {
      font-size : 9px;
      font-family : Verdana, Arial;
      line-height : 12px;
      color: ##152255;
      text-align : left justify;
}
</STYLE>

<title>Virtual Footy Invite - Win a $1199 Canon photo printer</title><table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
          <p>Click here <a href="http://www.cashmanager-footy.co.nz"><strong>www.cashmanager-footy.co.nz</strong></a>, then login using   your email address <strong>#qUsers.email#</strong> and your unique password: <strong>#qUsers.password#</strong>            </p>
          <p>PS. This game is by invite&nbsp;only.&nbsp;However if you want to use this game as an   office&nbsp;competition or to play against friends, just email me with their names and email addresses.</p>
          <p><span class="smalltext">If you do not wish to receive further emails&nbsp;regarding this competition reply   to this email with &quot;no thanks&quot; within the subject line or body.</span>
          </p>
          </td>
        </tr>
    </table>
</cfmail>

</cfoutput>

Emails sent.

LVL 1
gardenaAsked:
Who is Participating?
 
PluckaConnect With a Mentor Commented:
gardena,

NO,

You don't need the <cfoutput remember <cfmail is like <cfoutput so the <cfoutput is implied

Just have

<cfmail from="info@mysite.com" query="qUsers" to="#email#" subject="Virtual Footy Invite - Win a $1199 Canon photo printer" type="html">
content including #variables#
</cfmail>

Regards
Plucka
0
 
PluckaCommented:
gardena,

Ok, you shouldn't do <cfoutput around the <cfmail, don't think that works.

There is a query attribute on the <cfmail that you should specify instead.

<cfmail is like <cfoutput but the output goes to mail rather than the browser.

Regards
Plucka
0
 
gardenaAuthor Commented:
thanks plucka

So?

<cfmail from="info@mysite.com" query="qUsers" to="#email#" subject="Virtual Footy Invite - Win a $1199 Canon photo printer" type="html">
<cfoutput>
content
</cfoutput>
</cfmail>
0
 
gardenaAuthor Commented:
Plucka - thanks a million!
:-) gardena
0
All Courses

From novice to tech pro — start learning today.