the connection and recordset should be created on the main page that you apply universal email to, not in the template file.
In the email template file, you can use the recordset data, but the code to create the actual connection and the recordset itself should be on the main page.