|
-
Oct 28th, 2010, 09:46 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Creating and populating email templates
I have a page that is called from loads of different pages that basically sends emails. It has text boxes for Subject, From Address etc. and a textbox like the one I am typing in now (on this site) which allows users to format a html message.
I need to develop the functionality by providing email templates for the message.
So, the template text (which will be stored and retrieved from a database) might contain:
Dear .......
Thanks for attending the meeting.
Kind regards
.......
Where the ...... are, I would want to fill in the name of the person who is going to receive the email and the name of the person sending it.
So, I'm on the page - I've retrieved the text for the message from the database - I have SendersName and ReceiversName sitting there in variables - how do I get them in the text in the right place?
I was thinking I could make the template text look like this:-
Dear [ReceiversName]
Thanks for attending the meeting.
Kind regards
[SendersName]
and then, on the page, just Replace the various 'tags'. Is this a good idea?
Thanks for any suggestions.
-
Oct 28th, 2010, 02:18 PM
#2
Frenzied Member
Re: Creating and populating email templates
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Oct 28th, 2010, 10:47 PM
#3
Re: Creating and populating email templates
@Webskater, what you have proposed is actually a good idea, one that I have used in a few projects in the past.
If you want more sophistication, you could explore the XML/XSLT alternative, but it might be an overkill. For a simple template-based email app, inserting placeholders in the template and then replacing them with the actual values should work best.
.
-
Oct 29th, 2010, 02:30 AM
#4
Re: Creating and populating email templates
Webskater,
You can find an example here:
http://dotnettricks.com/blogs/roberh.../05/12/57.aspx
Hope that helps!
Gary
-
Oct 29th, 2010, 02:52 AM
#5
Thread Starter
Fanatic Member
Re: Creating and populating email templates
Thanks for all the replies. To be honest I thought it was a bit of a daft question, but it wasn't. I didn't know anything about what is shown in the link Gary provided - and that is just what I was after.
Thanks again.
-
Oct 29th, 2010, 02:55 AM
#6
Re: [RESOLVED] Creating and populating email templates
Not a problem at all, happy to help!!
Let us know if you have any problems.
Gary
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|