title: Error when executing query with variables in sp_send_dbmail
body: <p>I am trying to send emails individually to a list of recipients. I am receiving the error: </p>
  
  <pre><code>Msg 22050, Level 16, State 1, Line 0
  Error formatting query, probably invalid parameters
  Msg 14661, Level 16, State 1, Procedure sp_send_dbmail, Line 478
  Query execution failed: Msg 4104, Level 16, State 1, Server xxxxxx, Line 1
  The multi-part identifier "email@example.com" could not be bound.
  </code></pre>
  
  <p>Here is a simplified version of my code, asssuming table1 is a valid existing table and name and email are existing columns.</p>
  
  <pre><code>declare @current_mailaddress varchar(50), @query varchar(1000)
  set @current_mailaddress = 'email@example.com'
  
  set @query = 'select distinct name, email from table1 
                where email = ' + @current_email
  
  exec msdb.dbo.sp_send_dbmail 
   @recipients = @current_email,
   @subject = 'test',
   @query = @query
  </code></pre>
  
  <p>So according to the error, the formatting (of presumably the @query) is wrong. I can't figure it out. Any ideas?</p>