Thursday, February 3, 2011

E-mail Notifications

In a .net system I'm building, there is a need for automated e-mail notifications. These should be editable by an admin. What's the easiest way to do this? SQL table and WYSIWIG for editing?

  • Are you just talking about the interface and storage, or the implementation of sending the emails as well?

    Yes, a SQL table with FROM, TO, Subject, Body should work for storage and, heck, a textbox or even maybe a RichText box should work for editing.

    Or is this a web interface?

    For actually sending it, check out the System.Web.Mail namespace, it's pretty self explanatory and easy to use :)

    From Adam Haile
  • From a high level, yes. :D The main thing is some place to store the templates. A database is a great option unless you're not already using one, then file systems work fine.

    WSIWIG editors (such as fckeditor) work well and give you some good options regarding the features that you allow.

    Some sort of token replacement system is also a good idea if you need it. For example, if someone puts %FIRSTNAME% in the email template, the code that generates the email can do some simple pattern matching to replace known tokens with other known values that may be dynamic based on user or other circumstances.

    From palehorse
  • I am thinking that if these are automated notifications, then this means they are probably going out as a result of some type of event in your software. If this is a web based app, and you are going to have a number of these being sent out, then consider implementing an email queue rather than sending out an email on every event.

    A component can query the queue periodically and send out any pending items.

    From Vaibhav
  • The queue is a great idea. I've been throwing around that type of process for awhile with my old company.

  • Adam Haile writes:

    check out the System.Web.Mail namespace

    By which you mean System.Net.Mail in .Net 2.0 and above :)

  • How about using the new Workflow components in .Net 3.0 (and 3.5)? That is what we use in combination with templates in my current project. The templates have the basic format and the the tokens that are replaced with user information.

0 comments:

Post a Comment