Demo 1 - Email HTML | Demo
2 - Email PDF | Demo 3 - SQL to PDF | Demo
4 - Embedded Queries
Demo 5 - Prescheduled Queue | Demo
6 - Dynamic Queue | Demo 7 - Zip &
Password-Protect
Demo 8 - Mail Merge | Demo 9 -
Content Path | Demo 10 -
Excel Workbook | Demo 11 -
Word/RTF
Demo 8 - Mail Merge
| Description |
The mail-merge feature of SqlAnswersMail allows you to designate a query as a
mail-merge source and then display the fields from this query anywhere in a
message.
In this example, two rows from the Employees table of the Northwind database are
merged into the content and subject line of an email. Please note how
SqlAnswersMail renders the Photo field as an image without any additional
coding.
For simplicity purposes, both emails will be sent to your address, but in a
real-life scenario you would probably make the @recipients parameter
data-driven, which will allow you to send a customized email to many recipients
with one SQL statement.
|
| Email |
|
| SQL Code |
exec sp_sendSAM @recipients=provided in form, @subject='SqlAnswersMail Mail Merge Demo - Employee {EmployeeID}', @message='<p>This is a mail merge demo from SqlAnswersMail.</p><hr> <table cellpadding=10px> <tr> <td valign=top><img src="{Photo}"></td> <td valign=top> <b>First Name:</b> {FirstName}<br> <b>Last Name:</b> {LastName}<br> <b>Address:</b> {Address}<br> <b>City:</b> {City}<br> <b>State:</b> {Region}<br> <b>Postal Code:</b> {PostalCode}<br> <b>Country:</b> {Country}<br> <b>HomePhone:</b> {HomePhone}<br> </td> </table> <p>For more information, visit <a href="http://www.sqlanswers.com">www.sqlanswers.com</a></p>', @query='select top 2 * from northwind..employees', @merge_from_query=1, @format='html'
|