Email attachments

mike55

Contributor
Joined
Mar 26, 2004
Messages
727
Location
Ireland
Hi all

I have an email template stored in my web project. When I want to send an email to all the users, I just populate the data that has to change, and then proceed with sending the email.

I have now been told that instead of sending most of the data in the body of the email that I must attach it as an attachment.

Here is a sample of one of the email as it is currently send:
Welcome ##Forename## ##Surname## to www.mySite.eu.

You have registered with the following information:
Organisation Name: ##OrganisationName##
Organisation Id: ##OID##
Subscription Type: ##Type##
Mobile: ##Mobile##
Password: ##Password##

I then use the following code to replace the tags with the proper values:
Code:
Dim templateVar As New Hashtable
            templateVar.Add("OrgName", dsOrg.Tables("Organization").Rows(0).Item("Org_Name").ToString)
            templateVar.Add("Oid", org_ID)
            templateVar.Add("Currency", drwData(0).Item("Currency").ToString)
            templateVar.Add("Amount", Math.Round(dsOrg.Tables("OrderDetails").Rows(0).Item("Total"), 2))
            templateVar.Add("Order", dsOrg.Tables("OrderDetails").Rows(0).Item("Description").ToString)
            templateVar.Add("Net", Calculate(CType(dsOrg.Tables("OrderDetails").Rows(0).Item("Total"), Decimal), CType(drwData(0).Item("VAT"), Decimal), 2))
            templateVar.Add("Rate", drwData(0).Item("VAT").ToString)
            templateVar.Add("Vat", Calculate(CType(dsOrg.Tables("OrderDetails").Rows(0).Item("Total"), Decimal), CType(drwData(0).Item("VAT"), Decimal), 1))
            templateVar.Add("Total", Math.Round(dsOrg.Tables("OrderDetails").Rows(0).Item("Total"), 2))
            templateVar.Add("Purchase", ActionLabel(action))

 Dim emailBody As New Parser(ConfigurationManager.AppSettings("EmailTemplates") & _
                                "Registration.htm", templateVar)

To send the template in the body, I simply supply emailBody.Parse for the body property.

Any suggestions on how to adjust this so that I can access the template, modify it and attach it as a template?

Mike55.
 
Back
Top