• Nice article. Some questions though. If I want to include Cc and Bcc fields in the emails, how do I do it? How about the email Priority (Low, Normal, High Importance)

    Personally, I find it easier to create a simple C# application. I would create an HTML template and shoot the desired info from the database to template so that it looks like a nice HTML email. Using dynamic sql to build the HTML can be challenging for more complex emails (with formatting).

    Sample:

    CustomerList.htm:

    <tr>

    <td style="width:50px; text-align:center; color:Blue">

    [SNo]

    </td>

    <td style="width:150px; text-align:left; color:Blue">

    [CustomerCode]

    </td>

    <td style="width:300px; text-align:left; color:Blue">

    [CustomerName]

    </td>

    <td style="width:50px; text-align:center; color:Blue">

    [CustomerType]

    </td>

    <td style="width:50px; text-align:center; color:Blue;">

    [CustomerRank]

    </td>

    </tr>

    MainEmail.htm (headers, embedded styles and other formatting are removed)

    <tr>

    <td>

    <table>

    <tr class="DataGridHeaderGray">

    <td style="width:50px; text-align:center">

    S. No.

    </td>

    <td style="width:150px; text-align:center">

    Customer Code

    </td>

    <td style="width:400px; text-align:center">

    Customer Name

    </td>

    <td style="width:50px; text-align:center">

    Type

    </td>

    <td style="width:50px; text-align:center">

    Rank

    </td>

    </tr>

    [CUSTOMERLIST]

    </table>

    </td>

    </tr>

    Then create a StreamReader that will read the contents of the template. Loop through your list of, replace the tags in square brackets (SNo, CustomerCode, etc). Set the recipients (To, Cc and Bcc). Create a MailMessage object and send the email.

    Of course, there are other different ways. Cheers!